Skip to content

Commit

Permalink
Merge pull request #14 from Dakskihedron/set-content-type-header
Browse files Browse the repository at this point in the history
feat: set Content-Type header on responses
  • Loading branch information
karlvr authored Apr 4, 2024
2 parents 542680d + 5466d05 commit 18861bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-swans-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openapi-generator-plus/typescript-express-passport-server-generator": minor
---

Set Content-Type header on responses.
3 changes: 3 additions & 0 deletions templates/api.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export default function(app: Express, impl: t.{{className name}}Api) {
res.header({{{stringLiteral serializedName}}}, `${response.headers[{{{stringLiteral name}}}]}`)
{{/each}}
{{/if}}
{{#if defaultContent}}
res.set('Content-Type', {{{stringLiteral defaultContent.mediaType.mediaType}}})
{{/if}}
{{#if defaultContent.schema}}
res.send(body)
{{else}}
Expand Down

0 comments on commit 18861bc

Please sign in to comment.