< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next article (the next thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
I am unsure what `www_auth_response` is suppose to do.
Also you have `return` at the end of the `post_data` method which is
probably not what you want.
What does the server side request look like when you call this post method?
On Tue, Jun 11, 2013 at 3:58 AM, Kirill Grin <lists / ruby-forum.com> wrote:
> m fighting with post request of digest auth a few days and still can't
> get how to send json body. Please help me! Server told that i got in,
> but by json was not used. i'm using net/http/digest_auth gem. Is i think
> json must be placed in the right place, but I don't now where. Thanks a
> lot!
>
> def post_data
> uri = URI.parse 'http://somelink.com'
> uri.user = 'test'
> uri.password = 'test'
>
> data = {:ID => "123456789", :name => "me"}
> data_type = JSON.generate(data)
>
> digest_auth = Net::HTTP::DigestAuth.new
>
> h = Net::HTTP.new uri.host, uri.port
> h.set_debug_output $stderr
>
> req = Net::HTTP::Post.new uri.request_uri
> res = h.request req
>
> www_auth_response = res['www-authenticate']
> www_auth_response["algorithm=\"MD5\""] = "algorithm=MD5"
> auth = digest_auth.auth_header uri, www_auth_response, 'POST'
>
> req = Net::HTTP::Post.new uri.request_uri
> req.add_field 'Authorization', auth
> req.content_type= "application/json"
> req.body = data_type
>
> res = h.request req
> puts res.code
> return
> end
>
> --
> Posted via http://www.ruby-forum.com/.
>
>