Handling dynamic headers from transformFile

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
react, typescript
領域
frontend

調査の方向性

src/AjaxUploader.jsx の、upload リクエストに渡される headers から始め、issue に記載されている transformFile のフローを確認してください。動作と合わせて README の headers の項目を更新してください。変換後のファイルを受け取る関数として headers を指定でき、オブジェクト形式の headers も引き続き機能すれば完了です。

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

説明

Hi there!

We have a situation where we use rc-upload in the following manner:

  • User selects file on file system
  • We use transformFile to encrypt the contents of that file on the browser
  • The encryption generates additional metadata that we want to pass as headers
  • This metadata is not available until transformFile is completed.

It would be great if headers could also be a function that takes in the result of transformFile and returns the headers.

I tried to make a PR for this but it was not possible bc of permissions.

The changes to do this are pretty quick:
in AjaxUploader.tsx

change

headers: props.headers,

to

headers: typeof props.headers === 'function' ? props.headers(transformedFile) : props.headers,

and also update the README comment to me

|headers| object/function(blob) | {} | http headers to post, available in modern browsers. Can be a function that takes in the result of transformFile |

主要言語
TypeScript
スター
804
フォーク
323
平均マージ
12分
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

react-component/upload のほかの issue

react-component/upload の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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