Closed Bug 1164961 Opened 10 years ago Closed 10 years ago

client.py: Allow passing headers when uploading objects

Categories

(Taskcluster :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jlal, Unassigned)

References

Details

This is primarily to allow setting cache control headers on our s3 objects.
Blocks: 1164968
So the makeHttpRequest() method does have the ability to pass in custom headers as best as I can tell: def makeHttpRequest(method, url, payload, headers, retries=MAX_RETRIES): These get sent through to the actual method with: response = requests.request(method.upper(), url, data=payload, headers=headers) My understanding of how we do S3 things with the python client is to use the makeHttpRequest utility method from taskcluster/utils.py. Adding custom headers on the api methods would mean that we either need to change the signature to existing api methods, which would break compatibility with all implementors, or add a second method for each api which has a headers param like this: queue.createTask(taskId, payload) -> result queue.createTask(payload, taskId='value') -> result queue.createTaskWithHeaders(taskId, payload, headers) -> result queue.createTaskWithHeaders(payload, headers, taskId='value') -> result This is a little ugly, but I'd rather not go down the path of having special kwarg handling done based on the name of the kwarg for numerous reasons. I guess we could have a single method for the non-kwarg case to make it a little nicer.
As jhford points out this is already possible... We already set the headers Content-Length and Content-Type for S3, by passing them to makeHttpRequest(). So this is just a matter of adding the headers in mozharness. Hence, there is nothing to fix in tc-client.py
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Component: TaskCluster → General
Product: Testing → Taskcluster
Target Milestone: --- → mozilla41
Version: unspecified → Trunk
Resetting Version and Target Milestone that accidentally got changed...
Target Milestone: mozilla41 → ---
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.