小编Ale*_*mov的帖子

更改 *http.Client 传输

现状

选择了一个辅助项目(围绕第三方 API 构建包装器),我被困住了。我正在使用sling来编写我的 HTTP 请求。

所以客户端的部分组成如下:

type Client struct {
    // some services etc..
    sling *sling.Sling <-- this is initialized with *http.Client
}

func NewClient(httpClient *http.Client) *Client {
    sling := sling.New().Client(httpClient).Base(BaseURL)
}

//....
Run Code Online (Sandbox Code Playgroud)

我无法理解的事情

我遵循与go-githubgo-twitter相同的原则,即身份验证不应由我的库处理,而应由 golangs oauth1/2 包处理。

由于 API 提供应用程序和用户级身份验证,并且某些工作流需要初始应用程序级身份验证,然后是用户级身份验证,我的问题是,是否有任何方法可以更改以*http.Transport在客户端更改身份验证标头。

到目前为止,我还没有找到这样做的方法。

go

4
推荐指数
1
解决办法
4611
查看次数

删除处于“终止”状态的 linkerd kubernetes 命名空间

这是资源状态:

kind: Namespace
api
Version: v1
metadata:
  name: linkerd
  selfLink: /api/v1/namespaces/linkerd
  uid: e7337b2b-bddb-4344-a986-d450973bc8cf
  resourceVersion: '5540346'
  creationTimestamp: '2020-05-10T13:49:21Z'
  deletionTimestamp: '2020-06-03T20:16:30Z'
  labels:
    config.linkerd.io/admission-webhooks: disabled
    linkerd.io/is-control-plane: 'true'
spec:
  finalizers:
    - kubernetes
status:
  phase: Terminating
  conditions:
    - type: NamespaceDeletionDiscoveryFailure
      status: 'True'
      lastTransitionTime: '2020-06-03T20:16:44Z'
      reason: DiscoveryFailed
      message: >-
        Discovery failed for some groups, 1 failing: unable to retrieve the
        complete list of server APIs: tap.linkerd.io/v1alpha1: the server is
        currently unable to handle the request
    - type: NamespaceDeletionGroupVersionParsingFailure
      status: 'False'
      lastTransitionTime: '2020-06-03T20:16:38Z'
      reason: ParsedGroupVersions
      message: All …
Run Code Online (Sandbox Code Playgroud)

digital-ocean kubernetes kubectl linkerd kubernetes-namespace

3
推荐指数
1
解决办法
2526
查看次数