cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to fetch default response

Visitor

Failed to fetch default response

Hello everyone,

I have a question regarding the "Undocumented   TypeError: Failed to fetch" response inside of the Swagger UI.

This is not a CORS issue, I am not interested in fixing this error.
Is there a way to present this reponse in some other way, can I create my own default placeholder response for this?
This error would happen when the server is down. I want to have default response for this like: Server is down.


I realize that there is a default options I can add to reponses in yaml file, but this does not work if the server does not respond. Of course, there is no error code, there is just Status: (failed) (inside of the inspect Chome network tab).


Can I somehow cover this response, make it my own?

If that is not possible, can I make any not documentet request default to some http reponse code, like 500 for example?

Thank you

1 REPLY 1

Re: Failed to fetch default response

Hi @msens, there's no way to do this unfortunately. Swagger UI won't let you "fake" a response when the entire request fails.

 

If you want this behavior, I suggest putting a load balancer or reverse proxy in front of your server that is capable of sending back HTTP 500 responses when your API server is unavailable.