1

I'm doing the following get request on RSpec:

get "api/posts/#{@post.id}?api_key=#{Settings.api_key.android}&device_token=#{@device.token}&auth_token=#{@user.authentication_token}"

I need to specify the header.

on Postman my header looks something like this: https://www.dropbox.com/s/h1qmm9aqwu3xm4i/Screenshot%202015-11-30%2014.41.10.png?dl=0

How would I add my header to my get request on RSpec?

I've tried this:

get "api/posts/#{@post.id}?api_key=#{Settings.api_key.android}&device_token=#{@device.token}&auth_token=#{@user.authentication_token}", nil, {'ACCEPT' => 'application/vdn.foo.v10'} 

Without any success.

Any help would be greatly appreciated.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
neo
  • 4,078
  • 4
  • 25
  • 41

1 Answers1

1

Look at the answer in Set header in RSpec 3 request. You can access the request using the request variable as well and manipulate the headers directly on there.

Community
  • 1
  • 1
CWitty
  • 4,488
  • 3
  • 23
  • 40