Kong / Kong/apiembed

C# Code Snippet needs a clear handlers to work.

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Pug
Stars
413
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Our API requires that customers send vnd mime types in both the Accept and Content-Type headers.

With the C# example, the following code is provided:

```
var client = new RestClient("https://api.whispir.com/messages?apikey=REPLACE_ME");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/vnd.whispir.message-v1+json");
request.AddHeader("accept", "application/vnd.whispir.message-v1+json");
request.AddHeader("authorization", "");
request.AddParameter("application/vnd.whispir.message-v1+json", "{\"to\":\"\",\"subject\":\"\",\"body\":\"\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

The problem though is that the `request.AddHeader` method is not respected unless the following code is provided on line 2:

`client.ClearHandlers();`

This code clears the default handlers allowing the user to set custom headers.

Can you please include this in your out of the box rendering of C# code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the C# example renderer or template that produces the shown RestClient snippet; the issue does not name a file or test. Update the rendered example to include client.ClearHandlers() on line 2, then verify that the generated C# snippet contains it before the custom headers are added.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.