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

Issue with oats-axios-adapter when endpoint has no headers and content-type is DIFFERENT from application/json #373

Open
danyg opened this issue Nov 2, 2022 · 0 comments

Comments

@danyg
Copy link

danyg commented Nov 2, 2022

When using oats-axios-adapter with endpoints that don't define any headers and use content type different from application/json, i.e. only application/x-www-form-urlencoded.

The type for the endpoint headers is void THEN the generated Axios client fails to perform the call as it is expecting that the property headers be initialized as an object which is not.

The error occurs in /packages/oats-axios-adapter/index.ts#L90 as arg.headers is not checked for emptiness when construction the request headers from arg.headers and data.contentType

Steps to reproduce

  • Use the the packages/oats-mirage-adapter/test-app
  • Change or add content application/x-www-form-urlencoded to #/components/requestBodies/PostBody and try to generate an axios client with it.
  • make a post call with such client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant