Closed xuweidongkobe closed 5 years ago
Just for reference, this question is a continuation of #846 .
There were a few fixes that went in for MMS 1.0.5 and MMS 1.0.6 with regards to the HTTP headers and HTTP Error handling. I would recommend upgrading to later versions of MMS. The syntax that you are using will work for MMS 1.0.5 or later.
To answer your question specifically, in MMS 1.0.4, the context.set_response_content_type
interface took a request Identifier and not a request index as the first argument. So, to make it work you would have to write it as follows
context.set_response_content_type(context.request_ids[0], "application/json")
For full example, you could checkout this example code
@xuweidongkobe : Please let us know if this worked for you.
@vdantu : it worked for me. Thank you very much for your answer. It helped me a lot. It would be better if there were more documents between versions and MMS usage documents. Thank you.
@vdantu For some reason ,I am using mxnet-model-server (1.0.4), which version has no "set_response_header" proprety, but has "set_response_content_type" property, I add a line "context.set_response_content_type(0, 'application/json')" in custom service entry point function, but it not wokrs. Can you tell me how to solve the problem, thank you?