Skip to content

AbortError: The user aborted a request. #2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fanux opened this issue Aug 13, 2021 · 3 comments
Closed

AbortError: The user aborted a request. #2002

fanux opened this issue Aug 13, 2021 · 3 comments

Comments

@fanux
Copy link

fanux commented Aug 13, 2021

I want to fetch data using GET request:

 curl http://localhost:5000/v2/_catalog
{"repositories":["centos","golang"]}

the struct:

#[derive(Deserialize, Debug, Clone)]
pub struct RegistryCatalog {
    pub repositories: Vec<String>,
}

GET request when first render:

    fn rendered(&mut self, first_render: bool) {
        if first_render {
            ConsoleService::info("view app");
            let request = Request::get("http://localhost:5000/v2/_catalog")
                .body(Nothing)
                .expect("could not build request.");
            let callback = self.link.callback(
                |response: Response<Json<Result<RegistryCatalog, anyhow::Error>>>| {
                    let Json(data) = response.into_body();
                    ConsoleService::info(&format!("info {:?}", data)); 
                    Msg::GetRegistryCatelog(data)
                },
            );
            let task = FetchService::fetch(request, callback).expect("failed to start request");
        }
    }

But I got AbortError:
image

@fanux fanux added the bug label Aug 13, 2021
@fanux
Copy link
Author

fanux commented Aug 13, 2021

request header:

Request URL: http://localhost:5000/v2/_catalog
Referrer Policy: strict-origin-when-cross-origin
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Host: localhost:5000
Origin: http://127.0.0.1:8080
Pragma: no-cache
Referer: http://127.0.0.1:8080/
sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"
sec-ch-ua-mobile: ?0
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36

image

@siku2 siku2 removed the bug label Aug 13, 2021
@siku2
Copy link
Member

siku2 commented Aug 13, 2021

Please see #1438

@fanux
Copy link
Author

fanux commented Aug 18, 2021

It's worked~

@fanux fanux closed this as completed Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants