All ok except for Content-Type: application/json #2968
-
I've built a HTTP server and everything is fine. I can serve any Content-Type I want and everything works perfectly. I can serve JSON as long as I set However as soon as I set the (correct)
My typical response code:
I only need to change What do I miss? Hoppie |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
What is that ? Where is that ? How do you call that ? Where do you call that ? Who is the server ? Who is the client ? Where is Mongoose ? What version ? What platform ? Please sniff your network (using Wireshark, for example) and observe the traffic. If you can, that would be great |
Beta Was this translation helpful? Give feedback.
-
Please see our documentation, and follow the guidelines in our tutorials. |
Beta Was this translation helpful? Give feedback.
-
It's almost literally the code from the tutorials. By now I figured out what went wrong -- as I expected, I missed something. I tested the JSON returns using a flat web browser and typing the URL. I did not use any parameters, I just took this tutorial snippet: After scratching my head (I never assumed this was a Mongoose problem) I realized that the web browser (Firefox) never asked for JSON and probably just squeezed the favicon request right through the same request pipe. Although I still don't really understand what goes wrong here, not using FF for the JSON request but instead a flat I would love to understand the problem, but at least I now can avoid it. If somebody can offer the explanation, yes please. Otherwise I will close this issue in two days. Hoppie |
Beta Was this translation helpful? Give feedback.
-
Got it nailed. Two files attached:
Firefox attempts to upgrade the connection to TLS after the correct response to the request is received. |
Beta Was this translation helpful? Give feedback.
-
As the sources are 100% the As we are now mostly trying to reconstruct the way FF handles JSON returns, which is not very relevant, I propose to leave it at this. |
Beta Was this translation helpful? Give feedback.
Well, I can't agree and blame it on Firefox so quickly. Yes, I relieved Mongoose from any charges right from the start,
Your Wireshark capture is one-sided, there's only FF requests, I can't see Mongoose responses.
Your source is TL;DR, I've already read that here. I managed to get to the code and I see you are responding with a 500 code to something that requires a 400 response, 404 to be precise. I don't see that being exercised, though, as I don't see any of the Mongoose responses in that capture file
FF is not upgrading the connection, it is closing it and trying a new one using TLS. Two attempts. Why ? I would justify that if you requested a non-existent URL, since you just told it t…