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

Missing "Accept" Request Header in generated files based on OAS 3.0 #107

Closed
guillaumeserale opened this issue Aug 14, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@guillaumeserale
Copy link
Contributor

When Refitter generates Refit interfaces from a OAS 3.0 spec file, it doesn't add the "Accept" header , which necesssary for ASP.NET Core's ProblemDetails Middleware to function properly.

According to OAS 3.0 specification, The content property in responses contains the MIME type expected in the response.

I'm suggesting to add an optional parameter addAcceptHeaders to add the accept header.
Examples

  • without addAcceptHeaders:
        /// Multiple status values can be provided with comma separated strings
        /// </summary>
        [Get("/pet/findByStatus")]
        Task<ICollection<Pet>> FindPetsByStatus([Query(CollectionFormat.Multi)] IEnumerable<Anonymous> status);
  • with addAcceptHeaders:
        /// Multiple status values can be provided with comma separated strings
        /// </summary>
        [Headers("Accept: application/json")]
        [Get("/pet/findByStatus")]
        Task<ICollection<Pet>> FindPetsByStatus([Query(CollectionFormat.Multi)] IEnumerable<Anonymous> status);```


@christianhelle
Copy link
Owner

@guillaumeserale thanks for reporting this

@christianhelle
Copy link
Owner

@all-contributors please add @guillaumeserale for bug

@allcontributors
Copy link
Contributor

@christianhelle

I've put up a pull request to add @guillaumeserale! 🎉

@christianhelle
Copy link
Owner

Implemented in #108

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

No branches or pull requests

2 participants