API Error responses lacking correct headers #469
Labels
No Label
backups
blog
bootstrapping
bug
changes-requested
cli
documentation
duplicate
enhancement
facts
help wanted
invalid
Inventory
low_prio
manager
modules
needs-review
networking
packaging
question
secrets
template
test
tooling
user-testing
vm
wontfix
No Milestone
No project
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: clan/clan-core#469
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Usually our response headers look like this:
However if our api detects an error (tested with 500 internal server error) only the following headers exist.
Since access-control-allow-origin and access-control-allow-credentials is missing.
This is can also be interpreted as a Network Error, which it is not
I could of course add exceptions to the behavior of axios. (which i am using for request making) But that's unnecessarily complex and doesn't solve the root cause:
Ambiguity of both missing headers and an unrelated error message.
If viewing from API perspective, both have meaning.
Expected behavior
Please make sure all headers exist in all code-branches. So we can display correct error messages to the user.
Or if the ressource is really not accessible respond with "403 Forbidden"
Which i dont think is the case here
Problem is also "axios" (biggest library for making API requests) interprets headers more important than status codes and then displays, "Network Error" instead of "Internal Server Error" which is weird, but correct. Since the headers are missing this is one of the correct interpretations.
@hsjobeki Could you provide some instructions on how to reproduce this? I don't seem to get any of the
access-control-...
headers on any of our API responses:fixed in https://git.clan.lol/clan/clan-core/pulls/506/files