[Feature]: Allow setting global headers for Capacitor Http

オープン
#7,432 コメント 2 件 リアクション 4 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, typescript
領域
api, mobile

調査の方向性

CapacitorHttp の設定と native-bridge のエントリポイントを特定し、既存の User Agent 設定と比較します。iOS と Android で customHeaders をリクエストごとのヘッダーとどのようにマージすべきか確認します。完了とは、設定したヘッダーが両プラットフォームでリクエストに到達し、明示的なリクエストヘッダーが提案された優先順位を維持することです。

索引モデルが issue の本文から書いたものです。

説明

triage
Description

Add a section in the capactitor config for headers to be used by the capacitor Http plugin, similar to User Agent config.

Platforms
  • iOS
  • Android
  • Web
Request or proposed solution

I'm happy to do the changes for it if it something the maintainers would like to implement. I'm suggesting it as we have had to do it at work so requests to one of our APIs work.

In the capacitor configuration, something like this:

...
 plugins: {
    CapacitorHttp: {
      enabled: true,
      customHeaders: {
        Origin: 'example.com'
        ...
    },
...

Then in native-bridge:

convertBody(body).then(({ data, type, headers }) => {
  // Example based on the patch I wrote for our app:
  otherheaders = {
    ...customHeaders, // From cap config
    ...otherHeaders
  }
  ...
Alternatives

No response

Additional Information

No response

主要言語
TypeScript
スター
17.1k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/capacitor のほかの issue

ionic-team/capacitor の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。