http_session 0.2.0-rc.2 copy "http_session: ^0.2.0-rc.2" to clipboard
http_session: ^0.2.0-rc.2 copied to clipboard

outdated

This plugin helps you easier to manage the sessions when using http to requests.

Http Session #

If you want to login to a web service and keep comunicate with it, you need to save the session and use it for all the requests. This plugin will help you to do that.

Features #

Create an instance of http and manage the session.

Usage #

Use shared session across the application

final httpSession = HttpSession.shared;
httpSession.debugLog = true;
httpSession.maxRedirects = 5;

Or create a new session instance

final httpSession = HttpSession(
    client: HttpClient(), // Optional
    acceptBadCertificate: false,
    maxRedirects: 5,
    debugLog: true,
);

Please notice that the acceptBadCertificate will override the default value of the client (means client parameter is null). This setting is to decide whether to accept a secure connection with a server certificate that cannot be authenticated by any of the trusted root certificates.

Now you can requests any URI and the plugin will automatically save the session.

final response = await httpSession.post(url, body: data);
final response = await httpSession.get(url);

Clear the current session

httpSession.clear();

Close the current http and also clear the session

httpSession.close();

Get current session cookie header:

final headers = httpSession.headers;
0
likes
0
points
110
downloads

Publisher

unverified uploader

Weekly Downloads

This plugin helps you easier to manage the sessions when using http to requests.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on http_session