C# Code Snippet needs a clear handlers to work.

未关闭
#23 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
csharp
领域
documentation

调研方向

从生成所示 RestClient 代码片段的 C# 示例渲染器或模板入手;issue 未指明文件或测试。更新渲染后的示例,使其在第 2 行包含 client.ClearHandlers(),然后验证生成的 C# 代码片段在添加自定义标头之前包含该内容。

由索引模型根据 Issue 内容生成。

描述

help wanted

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", "<REPLACE_ME>");
request.AddParameter("application/vnd.whispir.message-v1+json", "{\"to\":\"<REPLACE_ME>\",\"subject\":\"<REPLACE_ME>\",\"body\":\"<REPLACE_ME>\"}", 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.

主要语言
Pug
星标
411
派生
52
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Kong/apiembed 的其他 Issue

查看 Kong/apiembed 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。