Skip to content

Is it possible to set different custom headers on a per request basis? #3353

Answered by jonemo
Frederik-Baetens asked this question in Q&A
Discussion options

You must be logged in to vote

I haven't had time to validate this, but I think this might be possible with the botocore event system today. You'd have to hook into two events:

  1. Hook into one event that occurs before operation parameter validation. In the handler, remove the non-standard operation parameter custom_arg from the list and store it in the request context object. This way you can pass it as additional kwarg to get_object as you propose without having it fail validation or cause errors during request serialization.
  2. Hook into another event that occurs when the HTTP request has already been serialized but before it gets sent. Fetch the custom parameter from the request context and inject it into the custom hea…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@Frederik-Baetens
Comment options

@Frederik-Baetens
Comment options

@Frederik-Baetens
Comment options

Comment options

You must be logged in to vote
1 reply
@Frederik-Baetens
Comment options

Answer selected by Frederik-Baetens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants