Skip to content

Cpprest does not set Content-Type header on POST requests. #4370

@sdrichter

Description

@sdrichter
Description

Cpprest does not set the Content-Type header on POST requests and so the server rejects all POST requests from this language.

Swagger-codegen version

Latest master build.

Swagger declaration file content or url

Any POST command with Content-Type as application/json.

Command line used for generation

java -jar swagger-codegen-cli.jar generate -l cpprest -i -o src

Steps to reproduce

Run swagger-codegen for language cpprest with a YAML file with at least one POST method that takes a content type of application/json.

Related issues

None

Suggest a Fix

I have fixed this on my fork by adding the following line to the api-source.mustache file:
headerParams[U("Content-Type")] = requestHttpContentType;

I will issue a pull request shortly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions