Method Summary | |
---|---|
Boolean | #addFile(parameterName, fileName, fileLocation) Add a file to the post. |
Boolean | #addHeader(headerName, value) Add a header to the request. |
Boolean | #addParameter() Add a parameter to the post. |
Response | #executeRequest([username], [password]) Execute the request method. |
void | #setBodyContent(content) Set the body of the request. |
void | #setCharset() Set the charset used when posting. |
Method Details |
---|
addFile |
Boolean addFile (parameterName, fileName, fileLocation) |
Add a file to the post. |
Parameters parameterName fileName fileLocation |
Returns Boolean |
Sampleposter.addFile('myFileParamName','manual.doc','c:/temp/manual_01a.doc') poster.addFile(null,'postXml.xml','c:/temp/postXml.xml') // sets the xml to post |
addHeader |
Boolean addHeader (headerName, value) |
Add a header to the request. |
Parameters headerName value |
Returns Boolean |
Samplemethod.addHeader('Content-type','text/xml; charset=ISO-8859-1') |
addParameter |
Boolean addParameter () |
Add a parameter to the post. |
Returns Boolean |
Sampleposter.addParameter('name','value') poster.addParameter(null,'value') //sets the content to post |
executeRequest |
Response executeRequest ([username], [password]) |
Execute the request method. |
Parameters [username] [password] |
Returns Response |
Samplevar response = method.executeRequest() |
setBodyContent |
void setBodyContent (content) |
Set the body of the request. |
Parameters content |
Returns void |
Samplemethod.setBodyContent(content) |
setCharset |
void setCharset () |
Set the charset used when posting. If this is null or not called it will use the default charset (UTF-8). |
Returns void |
Samplevar poster = plugins.http.getPoster('https://twitter.com/statuses/update.json'); poster.addParameter('status',globals.textToPost); poster.addParameter('source','Test Source'); poster.setCharset('UTF-8'); var httpCode = poster.doPost(globals.twitterUserName, globals.twitterPassword); //httpCode 200 is ok |