1

I am trying to convert this request header into Ruby format:

curl http://example.com/api/v1/info -H 'Authorization: Token token="asklasjqwAiSo1s2dj5ias23dkl"'

I am trying to add it to an HTTP GET request:

http = Net::HTTP.new(endpoint, 80)
http.get(path, authorization_header_with_token)

How would I build the header I used in the cURL request to work with the Ruby request?

1 Answer 1

1

The header hash parameter should look like this:

http.get(path, {'Authorization' => 'Token token="asklasjqwAiSo1s2dj5ias23dkl"'})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.