Skip to content

Help Wanted Swagger code generation c# restsharp #9041

Description

@pratik8490
Description

In swagger generated code for c#, urlencode method is declared using restsharp.contrib namespace but that namespace is not available in new restsharp nuget package and also there is one change needed for request.addfile method to add content length when action is added in code.

Swagger-codegen version

Not sure about version, I am generating code online using this editor.

https://editor.swagger.io/

Swagger declaration file content or url

http://petstore.swagger.io/v2

Suggest a fix/enhancement

Both issue can be fixed by replacing lines mentioned below in client folder and apiclient file.

First Change
Line no 92
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);

please change it to
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);

Second Change
Line no 119
return RestSharp.Contrib.HttpUtility.UrlEncode(str);
please change it to
return HttpUtility.UrlEncode(str);

as we can use httputility from system.web as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions