DMTF / Redfish-Mockup-Server

A simple Python 3.4 program that can be copied into a folder at the top of any Redfish mockup and can serve Redfish requests on the specified IP/port.
Other
83 stars 37 forks source link

enhancement: Content-Length header as an option on command line ? #87

Closed donzef closed 2 years ago

donzef commented 2 years ago

Versions 1.1.6 and 1.1.7 introduce the Content-Length header in responses. This breaks scripts piping responses in JSON processors like jq.

Would it be possible to have the Content-Length included in responses only if asked on the command line ?

Thanks

mraineri commented 2 years ago

We can consider adding that option, but it concerns me that additional HTTP headers in the response would break tools like that. It's pretty common for services to have additional headers outside the Redfish spec definition, and Content-Length is a pretty common response header that's included. The JSON part of the response is solely in the response body, so I'm not sure why they'd be using the HTTP response headers in the JSON processing. Are you able to provide examples of the issue you're seeing?

donzef commented 2 years ago

It appears that when I added the CORS support in version 1.1.7, I broke something in related to headers.

I am definitively not a programmer !

Closing for now, waiting for the issue #86 to be closed.