nativescript-community / nativescript-community/https
GET fails with 'android.os.NetworkOnMainThreadException'
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Vue
- Star
- 52
- Fork
- 40
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện yêu cầu GET từ issue trên Android và so sánh đường đi của @nativescript-community/https với core/http. Theo dõi nơi yêu cầu được dispatch và xác định lý do yêu cầu đến main thread, sau đó xác minh rằng cùng yêu cầu đó hoàn tất mà không có NetworkOnMainThreadException và hành vi Android hiện có vẫn được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, javascript
- Lĩnh vực
- mobile, networking
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100