Skip to content

Instantly share code, notes, and snippets.

@naoya
Created October 15, 2011 06:45
Show Gist options
  • Save naoya/1289165 to your computer and use it in GitHub Desktop.
Save naoya/1289165 to your computer and use it in GitHub Desktop.
wsseHeader = require './lib/wsse'
request = require 'request'
entry =
url: 'http://d.hatena.ne.jp/naoya/#atompost'
comment: "This is it"
xml = """
<entry xmlns="http://purl.org/atom/ns#">
<title>dummy</title>
<link rel="related" type="text/html" href="#{entry.url}" />
<summary type="text/plain">#{entry.comment}</summary>
</entry>
"""
request
url: 'http://b.hatena.ne.jp/atom/post'
headers:
'X-WSSE': wsseHeader 'naoya', 'password'
method: 'POST'
body: xml
, (err, response, body) ->
console.log response.statusCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment