Skip to content

fix produces with type parameter#251

Merged
casualjim merged 1 commit intogo-openapi:masterfrom
martian4202:fix-produces-with-type-parameters
Jul 14, 2022
Merged

fix produces with type parameter#251
casualjim merged 1 commit intogo-openapi:masterfrom
martian4202:fix-produces-with-type-parameters

Conversation

@martian4202
Copy link
Copy Markdown
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
Copy Markdown

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.

2 participants