Welcome! Log In Create A New Profile

Advanced

[WD23] Cannot Set Content-Type After Using WriteHTTPCode

[WD23] Cannot Set Content-Type After Using WriteHTTPCode
December 18, 2019 07:20PM
Hello everyone,

I have a little problem concerning the function WebserviceWriteHTTPCode function (WebserviceWriteHTTPCode documentation). Basically, after I called the function to set the HTTP code of the response to, let's say, 503, the server sends a response with the following Content-Type header : text/plain; charset=utf-8. The problem is that I don't want to send a response in plain text, I want the Content-Type to match the format requested by the user. I tried using the WebserviceWriteMIMEType function, but I think it's getting ignored completely.


Here's my code :
WebserviceWriteMIMEType(typeMimeJSON)
WebserviceWriteHTTPCode(Code, ToJSON())
		
RESULT ToJSON()

It's actually very simple. This code is part of a Class method and the ToJSON function simply convert the current Class's instance to JSON.

Thanks in advance for any help !

Anthony Blanchette-Potvin
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: