Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Conversation

@chexxor
Copy link
Contributor

@chexxor chexxor commented Mar 19, 2012

I believe it's pretty common to set HTTP headers when using REST. I added a parameter to the apexrest function to pass in a map of header names to head values. What do you think?

Example:

forcetk.Client.apexrest('attach',
function(msg){ alert('rest response'+msg); },//callback
function(msg){ alert('err:'+msg.responseText); },//error
'POST',//method
e.target.result,//payload
{upload_filename:"filename", upload_pid:"parentObjectID"},//paramMap
true);//retry

Signed-off-by: Alex Berg [email protected]

@chexxor
Copy link
Contributor Author

chexxor commented Mar 21, 2012

Alright, I moved the retry parameter to the far right. I also fixed the method called in the error callback. Good catch!

@chexxor
Copy link
Contributor Author

chexxor commented Mar 28, 2012

Don't know if it's helpful, but here's a working example that uses the new method signature in this pull request.

https://github.com/chexxor/Multi-File-Uploader-Force.com/blob/master/src/staticresources/FileUploadRestJS.resource#L248

@metadaddy
Copy link
Contributor

Wow - I can't believe this pull request is still open - apologies - merging now!

metadaddy pushed a commit that referenced this pull request Nov 9, 2012
Allow to set header for apexrest function.
@metadaddy metadaddy merged commit 75c6fbf into developerforce:master Nov 9, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants