When you use raw-requests command and try to specify custom headers with hyphens, all the hyphens are dropped:
$ oci raw-request --request-headers '{"foo-bar": "baz"}' --http-method GET --target-uri https://objectstorage.uk-london-1.oraclecloud.com/n --debug
send: 'GET /n HTTP/1.1\r\nconnection: keep-alive\r\naccept-encoding: gzip, deflate\r\naccept: */*\r\nuser-agent: Oracle-PythonSDK/2.10.5 (python 2.7.16; x86_64-Darwin) Oracle-PythonCLI/2.9.3\r\nopc-request-id: 08799DD98DB34954A1D3B51EA5807049\r\nfoobar: baz\r\ndate: Tue, 31 Mar 2020 02:35:03 GMT\r\nhost: objectstorage.uk-london-1.oraclecloud.com\r\ncontent-type: application/json\r\nauthorization: Signature algorithm="rsa-sha256",headers="date (request-target) host",k.....
Note: foobar: baz
It looks to be this line:
https://github.com/oracle/oci-cli/blob/master/src/oci_cli/raw_request_cli.py#L59
I believe it needs to call with:
additional_headers = cli_util.parse_json_parameter('request_headers', request_headers, 'camelize_keys', False)
else parse_json_parameter is doing a bunch of mangling of the keys. When I make the change locally, I can see the correct headers:
$ oci raw-request --request-headers '{"foo-bar": "baz"}' --http-method GET --target-uri https://objectstorage.uk-london-1.oraclecloud.com/n --debug
send: 'GET /n HTTP/1.1\r\nconnection: keep-alive\r\naccept-encoding: gzip, deflate\r\naccept: */*\r\nuser-agent: Oracle-PythonSDK/2.10.5 (python 2.7.16; x86_64-Darwin) Oracle-PythonCLI/2.9.3\r\nopc-request-id: 87213D716F534058803A044F1D868700\r\nfoo-bar: baz\r\ndate: Tue, 31 Mar 2020 02:38:04 GMT\r\nhost: objectstorage.uk-london-1.oraclecloud.com\r\ncontent-type: application/json\r\nauthorization: Signature algorithm="rsa-sha256",headers="date (request-target) host",k...
Note: foo-bar: baz
When you use
raw-requestscommand and try to specify custom headers with hyphens, all the hyphens are dropped:Note:
foobar: bazIt looks to be this line:
https://github.com/oracle/oci-cli/blob/master/src/oci_cli/raw_request_cli.py#L59
I believe it needs to call with:
additional_headers = cli_util.parse_json_parameter('request_headers', request_headers, 'camelize_keys', False)else parse_json_parameter is doing a bunch of mangling of the keys. When I make the change locally, I can see the correct headers:
Note:
foo-bar: baz