Forum Discussion

richie's avatar
richie
Community Hero
6 years ago

json response is 'plain/text' type. Anyway to change type to 'application/json'?

Hey

A 3rd party's webservice response payload is a wellformed json fragment (wellformed json confirmed by doing a wellformed check in xmlspy),but the Content-Type header on response is 'plain/text' rather than 'application/json' meaning the payload in the response is represented as a single string of text in the response's Outline tab making creating assertions difficult.

Before now when i wanted to change the type of the response (say from xml to json), i'd add an Accept header (value = application/json) to the request.

However adding the Accept header to the request did NOT change the response's type from text to json.

Would anyone have any ideas how i could get the response to be treated as json in ReadyAPI!s Outline tab?

Could an event handler do this? i.e. not actually change the type of the response, but change how its represented in the Outline tab?

Cheers!

Rich
  • nmrao's avatar
    nmrao
    Champion Level 3
    Can't it possible to request the service provider to make it change?
    • richie's avatar
      richie
      Community Hero
      Hey Rao,

      Nah...it's an external 3rd party's webservice. :(


      Cheers,

      Rich
      • nmrao's avatar
        nmrao
        Champion Level 3
        3rd Party services? So what, if there is defect or issue arises, it must be addressed. Not sure what is obstructing not to make a request.
    • Olga_T's avatar
      Olga_T
      SmartBear Alumni (Retired)

      Thanks everyone for your replies!

       

      richie, have you found a solution? Did any of the replies above help?

      • richie's avatar
        richie
        Community Hero
        Hey Olga_T

        Nah....we didn't find a way around the defect.
        Typically youd use the Accept header value=application/json on the request, but this doesnt work in this instance, so i can't really marked this as "answered".

        Cheers,

        Rich