Redfish-Interface-Emulator icon indicating copy to clipboard operation
Redfish-Interface-Emulator copied to clipboard

Service of static redfish tree GET response with ContentType: application/xml instead of ContentType: application/json

Open JohnMayfieldHPE opened this issue 2 years ago • 5 comments

Running a vanilla copy of v1.1.8 on a static redfish mockup starts the service and finds the redfish tree in the static directory OK, however when doing a GET on the service_root (or any other URI within the static tree) returns the content with the response header value ContentType set to application/xml instead of application/json. This causes the client browser to attempt to parse the response as XML and returns errors to the user: XML Parsing Error: not well-formed

JohnMayfieldHPE avatar Oct 27 '22 15:10 JohnMayfieldHPE

Just tested the emulator using Postman and the response has Content-Type = application/json. Will look further.

jcleung5549 avatar Oct 27 '22 17:10 jcleung5549

When you make the GET request, is "Accept: application/json" set in the request header?

jcleung5549 avatar Oct 27 '22 17:10 jcleung5549

I was only using firefox for initiating the GET request, not postman. I'm not sure how to tell Firefox to explicitly set Accept: application/json in the headers.

JohnMayfieldHPE avatar Oct 27 '22 18:10 JohnMayfieldHPE

A search finds...

Change FireFox's default Accept header to prefer JSON over XML

  • In the address bar in FireFox, type “about:config”.
  • Click the “I promise” button.
  • In the search bar type “network. http. ...
  • Double-click the setting.
  • In the comma-separated list add a new value of “application/json” (without the quotes)

jcleung5549 avatar Oct 27 '22 18:10 jcleung5549

I think that is my problem, I didn't have the acceptable header content types in the request from firefox. I'll adjust and most likely close this issue. Thank you for the help John!

JohnMayfieldHPE avatar Oct 27 '22 18:10 JohnMayfieldHPE