NativeScript / NativeScript/plugins
[@nativescript/background-http] upload error responseCode = -1
オープン
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 206
- フォーク
- 123
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 1
説明
Please, provide the following version numbers that your issue occurs with:
CLI: 7.0.10
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.0.5",
angular 10.2.1
When I upload a file, I get the error below.
e.responseCode = -1
this is my code
public _uploadBinary(fileName: string) {
this.file = fileName;
const name = this.file.substr(this.file.lastIndexOf('/') + 1);
const description = `${name}`;
const request = {
url: this.avatarUrl,
method: 'POST',
headers: {
"Content-Type": "application/octet-stream",
"File-Name": name,
"Authorization": `Bearer ${this.authTokenService.token}`
},
description: description,
androidAutoDeleteAfterUpload: true,
androidNotificationTitle: 'NativeScript HTTP background',
};
let task: Task;
var params = [{name: name, value: "value"}, {name:"fileToUpload", filename: this.file, mimeType: 'image/jpeg'}];
task = this.session.multipartUpload(params, request);
task.on("progress", (e) => {
console.log("upload progress", JSON.stringify(e));
});
task.on("error", (e) => {
console.log("upload error", JSON.stringify(e));
alert("error received " + e.responseCode + " code.");
});
task.on("responded", (e) => {
console.log("responded", JSON.stringify(e) );
console.log("responded data", JSON.stringify(e.data) );
});
task.on("complete", (e) => {
console.log("upload complete", JSON.stringify(e));
});
this.tasks.push(task);
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告されている NativeScript CLI、Android、iOS、Angular のバージョンで _uploadBinary 内の multipartUpload 呼び出しを再現することから始め、次に responseCode -1 に対する background-http タスクのエラー処理を調査します。Android と iOS の動作を比較し、アップロードがサーバーに到達するかどうかを判断します。原因を特定し、エラーの動作を文書化または修正できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- android, angular, ios, typescript
- 領域
- mobile-dev, networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100