Why does the response have a status of 200 but a status code of 406?
I am trying to pass a session ID and one parameter having a unique ID. But the output is not what I expected. I have a simple API on Salesforce, which can return simple user data. But it is showing that the HTTP status and statusCode are different from each other. Why is that happening? What can be done to make those the same?
When the status code 200 and the status code 406 occur, there are usually two different codes. For example, 200 refers to the response code, which can be used by writing response.statusCode. This code implies that the request was successful and was processed by the server, showing a successful response. However, the 406 on the response header may look inaccessible.
But most of the time, if you want your status and status code to be the same, you must take care of what you want to pass in response.header.statusCode() and response.statusCode(). Usually, keeping the value the same solves the issue entirely.