Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created July 23, 2013 13:28
Show Gist options
  • Select an option

  • Save sheldonh/6062341 to your computer and use it in GitHub Desktop.

Select an option

Save sheldonh/6062341 to your computer and use it in GitHub Desktop.
casperjs PUT example
casper = require('casper').create()
casper.start().thenOpen('http://localhost:9005/', {
method: 'put'
data:
username: 'foo'
password: 'bar'
}, -> @echo "PUT sent")
casper.run()
###
Produces:
PUT / HTTP/1.1
Origin: null
User-Agent: Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) CasperJS/1.0.2+Phantomjs/1.9.0 Safari/534.34
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Content-Length: 25
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: en-US,*
Host: localhost:9005
username=foo&password=bar
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment