luckyframework/lucky

ApiClient doesn't return custom headers

jwoertink opened this issue · 1 comments

If you have an action that sets a custom header, then you want to test that the header is returned, the ApiClient doesn't seem to have those.

I'm not totally sure, but maybe because it rebuilds a new response object?

HTTP::Client::Response.from_io(buffer.rewind)

class SomeAction < ApiAction
  get "/foo" do
    response.headers["X-TEST"] = "test"
    json({response: "ok"})
  end
end

client = ApiClient.new
response = client.exec(SomeAction)
response.headers["X-TEST"] # does not exist

ugh... ok, this was just my bad. Something I was doing in my app...