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

fix produces with type parameter #251

Merged

Conversation

martian4202
Copy link
Contributor

A path object can specify produces with an array of MIME types, as shown following:

/path:
    produces:
          - text/plain; charset=utf-8
    ....

In the latest release, the MIME-type parameters(charset=utf-8 in this case) is normalized and ignored and we get a map from the normalized MIME type to the runtime.Producer. However, when determining what runtime.Producer to use to response to the client, it uses the unnormalized MIME type.

var format string
format, r = c.ResponseFormat(r, offers)
rw.Header().Set(runtime.HeaderContentType, format)

if resp, ok := data.(Responder); ok {
	producers := route.Producers
	prod, ok := producers[format]

@codecov
Copy link

codecov bot commented Jul 14, 2022

Codecov Report

Merging #251 (1c6d707) into master (5bcfe65) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
- Coverage   80.18%   80.13%   -0.06%     
==========================================
  Files          42       42              
  Lines        3189     3191       +2     
==========================================
  Hits         2557     2557              
- Misses        519      521       +2     
  Partials      113      113              
Impacted Files Coverage Δ
middleware/context.go 73.55% <0.00%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bcfe65...1c6d707. Read the comment docs.

@casualjim casualjim merged commit 53ffffd into go-openapi:master Jul 14, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants