nativescript-community / nativescript-community/https
GET fails with 'android.os.NetworkOnMainThreadException'
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Vue
- Sterne
- 52
- Forks
- 40
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm testing on Android so I don't know about iOS.
Test code:
import * as HTTP from '@nativescript-community/https';
...
let url = "https://historylines.com/nexus/ttw.jsp?a=add&app=LA&uid=test_fde9f33899e13fcc&drill=Open%20Shooting%20-%20Single%20Target&shots=7";
console.log("logSession: "+url);
HTTP.request({
url: url,
method: "GET",
timeout: 30000
})
.then((response) => {
let content = response.content.toJSON();
console.log("logSession response: "+JSON.stringify(content, null, 4));
if(!content){
console.error("logSession response is missing content");
reject("logSession response is missing content");
}else{
resolve(content);
}
})
.catch((err) => {
console.error("logSession failed, "+err);
reject(err);
});
When I run this code or similar with core/http, it succeeds. When I put the URL in a web browser, it succeeds. When I run with https, it fails with:
logSession failed, Error: android.os.NetworkOnMainThreadException
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die GET-Anfrage aus dem Issue unter Android zu reproduzieren, und vergleiche den Pfad von @nativescript-community/https mit core/http. Verfolge, wo die Anfrage verteilt wird, und ermittle, warum sie den main thread erreicht. Überprüfe anschließend, dass dieselbe Anfrage ohne NetworkOnMainThreadException abgeschlossen wird und dass das bestehende Android-Verhalten erhalten bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, javascript
- Bereich
- mobile, networking
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100