aws4-axios
aws4-axios copied to clipboard
Added support for X-Amz-Content-Sha256.
Coming from https://github.com/opensearch-project/opensearch-api-specification/pull/483 where I was trying to add support for Amazon OpenSearch Serverless to already working support for Amazon Managed OpenSearch. The serverless implementation requires an X-Amz-Content-Sha256
for all requests, including GET
with or without a body. Adds an option to add the header.
Before:
[INFO] Authenticating using SigV4 with ... (us-west-2) ...
OpenSearch 2.1
[INFO] => POST /_bulk ({}) [application/x-ndjson] "{\"create\":{\"_index\":\"movies\"}}\n{\"director\":\"Bennett Miller\",\"title\":\"Moneyball\",\"year\":2011}\n"
[INFO] <= 403 (application/json) | {
"reason": "403 Forbidden",
"type": "Forbidden"
}
[INFO] => DELETE /books,movies ({}) [application/json]
[INFO] <= 403 (application/json) | {
"reason": "403 Forbidden",
"type": "Forbidden"
}
After:
[INFO] Authenticating using SigV4 with ... (us-west-2) ...
OpenSearch 2.1
[INFO] => POST /movies/_doc ({
"refresh": true
}) [application/json] {
"director": "Bennett Miller",
"title": "Moneyball",
"year": 2011
}
[INFO] <= 400 (application/json) | {
"root_cause": [
{
"type": "status_exception",
"reason": "true refresh policy is not supported."
}
],
"type": "status_exception",
"reason": "true refresh policy is not supported."
}
[INFO] => DELETE /movies ({}) [application/json]
[INFO] <= 200 (application/json; charset=UTF-8) | {
"acknowledged": true
}
Open to renaming the option to something else, adding more tests as needed, etc.