Skip to content

Cannot Send GET Request with Content-Type Header with RestSharp v107 #1722

@PierreCollardSuero

Description

@PierreCollardSuero

After upgrading to v107, I started getting the following error when trying to execute a GET request with the Content-Type: application/force-download header:
Cannot send a content-body with this verb-type.

The header is the only parameter in the request, but it seems like RestSharp transparently adds a body causing the error.

All attempts below causes the error mentioned when executing the request:
restRequest.AddHeader("Content-Type", "application/force-download");
restRequest.Parameters.AddParameter(new BodyParameter("", "", "application/force-download", DataFormat.None));
restRequest.AddStringBody("", "application/force-download");

While it may not be a good practice to use this header parameter with a GET request, it is unfortunately required for me to perform some operation with a system from a vendor and the last version of RestSharp does not support this anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-infoNot enough information provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions