cancel
Showing results for 
Search instead for 
Did you mean: 

Mock service Content type is changing to text/plain when i deployed my mock service in server

Occasional Contributor

Mock service Content type is changing to text/plain when i deployed my mock service in server

I had developed a REST mock service. When i tested in my local using soap ui, it is working fine. As soon as i have deployed my mock service to server, i am not able to read my header part. i am able to read the header if i hit the end point using soap ui, however i am not able to read the header if my other component hits the endpoint directly or via postman.

3 REPLIES 3
Community Hero

Re: Mock service Content type is changing to text/plain when i deployed my mock service in server

You're getting different results from two different clients. So their requests are likely different. Most likely, it is the Accept header. The client should specify what type of content it wants to receive.

 

Accept: application/json

or

Accept: application/xml

etc

Then server should reply with matching Content-Type (if it's not an error).

 

Highlighted
Occasional Contributor

Re: Mock service Content type is changing to text/plain when i deployed my mock service in server

Thanks a lot.. However, where should i mention this in my script?

Actually, when i hit from soap ui, i could see application/json in content type in raw tab. And even i checked my xml file deployed in server and i could see that media type is mentioned as application/json.

Could you please let me know where should i mention this accept header? in groovy script or in server?

 

Community Hero

Re: Mock service Content type is changing to text/plain when i deployed my mock service in server

Accept header should be specified by the client. For example, in Postman or what you called the "other component."

New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win