1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Why doesn't Flutter Http library return full response headers?

Discussão em 'Mobile' iniciado por Stack, Novembro 1, 2024 às 02:32.

  1. Stack

    Stack Membro Participativo

    I got very simple Flutter Http post request, it almost works, except, it seems it doesn't return all response headers.

    The request code is below:

    var apiUrl = '${rootUrl}api/auth/login';
    final response=await http.post(
    Uri.parse(apiUrl),
    headers: <String,String> {
    "Content-Type": "application/json; charset=UTF-8",
    },
    body: jsonEncode({
    "userName": userName,
    "password": password,
    })
    );
    print(response.headers);


    Below is the response header from Chrome, the server definitely returns all the headers, however, flutter http library only prints "Content-Type" header, no more, I want to read some customized header, e.g. "Hello", did some extra setup before sending post?

    (The http library I used is https://pub.dev/packages/http, version 1.2.2)

    [​IMG]

    Any ideas? Thanks.

    Continue reading...

Compartilhe esta Página