1

When testing the handling of a callback, the post should return the contents of the body.

I've tried setting it up using the required keyword arguments:

post '/api/v1/callbacks`, body: { foo: 'bar' }

I want the params to be { foo: 'bar' } but they're being returned as { body: { foo: 'bar' } }.

Is there a way I can use the keyword args while not adding the unwanted body key to the params?

Vasilisa
  • 4,604
  • 3
  • 20
  • 25
darkmoves
  • 328
  • 3
  • 12

2 Answers2

1

There in no body argument, only params

post '/api/v1/callbacks', params: { foo: 'bar' }
Vasilisa
  • 4,604
  • 3
  • 20
  • 25
0

In case you want to pass a whole hash as params, instead of having to specify each value, you can do:

post '/post_path', params_hash.merge({:format => 'json'})

See here for more details: https://stackoverflow.com/a/70396862/7724157

Nico Brenner
  • 690
  • 7
  • 11