Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OneSDK overrides the custom accept header #264

Closed
jnv opened this issue Jul 26, 2022 · 1 comment · Fixed by #290
Closed

[BUG] OneSDK overrides the custom accept header #264

jnv opened this issue Jul 26, 2022 · 1 comment · Fixed by #290
Assignees
Labels
bug Something isn't working

Comments

@jnv
Copy link
Contributor

jnv commented Jul 26, 2022

Given the following http request:

  http GET "/example" {
    request {
      headers {
        Accept = "application/json"
      }
    }
    response 200 "application/json" {
      // handle correct result
    }
    response {
      // handle everything else
    }
  }

Expected Behavior

The request should be sent with accept: application/json.

Current Behavior

I see the following with DEBUG=superface:http:sensitive env:

In case I name the header in the map as accept (lowercase a), I don't see it in the debug output at all.

Possible Solution

Note that this could be an issue with debug output, I didn't test what header actually reaches the endpoint in the end.

The current implementation of the interpreter collects expected response types and passes them to the request. If any of the response handlers is missing a response type, */* is set instead. It is likely that somewhere down the line, the passed-in accept parameter overrides the user-provider header.

Your Environment

@jnv jnv added the bug Something isn't working label Jul 26, 2022
@freaz freaz self-assigned this Sep 27, 2022
@freaz
Copy link
Member

freaz commented Oct 4, 2022

Finally got to this and definitely something odd is happening there.

image

And it seems it is caused by case sensitivity when resolving headers.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants