Open marketier opened 9 months ago
Any thoughts on the above case? What's the best way of troubleshooting or gathering more details about what GOT is attempting to post? Thanks.
Hi @marketier, I don't think it's an issue with Got itself, but with your API server: 500 status code reflects an issue on server side.
The best way you could investigate it is to check API server debug-level logs while doing requests from Got. Hopefully, those logs will contain more information about the reasons why it can't process requests received from Got.
If you don't have an access to the server logs, or they are not descriptive enough, you could go other way:
For example, from your server logs it's clear that User-Agent
header sent by Postman is set to PostmanRuntime/7.36.1
, but the same header sent by Got is set to got+(https://github.com/sindresorhus/got)
— try staring with this information, maybe even this particular header causes some issues on API server side.
Post request to API returns Response code 500 (Internal Server Error)
I have an API written in C# .NET. One of the endpoints allows users to unsubscribe from emails and does not return any json response.
When using CURL or Postman, the API returns a 200 status code. GOT returns a 500 server error. On the web server itself, I see the following in logs:
I am unable to upgrade to a more recent version of nodejs as the host is outside of our control.
I can confirm the issue also occurs on Nodejs 18 and Nodejs 20 in got@14.2.0.
Actual behavior
The following error is reported after running the script:
Expected behavior
Curl and Postman both return 200 status codes. Expecting the same from GOT.
Code to reproduce
The API endpoint in the sample is an non-working example but the rest of the code is valid.