# w_transport 1.0.0

A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'w_transport:1.0.0'
```
Published: 2015-05-21T19:04:00.095Z
Expected archive SHA-256: 3222509a4df44745ef0eb0b18e31f4c5809f3a788230c4ac4a1f185ee748163f

Available in cache; verification: upstream_checksum
## Direct dependencies
- fluri: >=1.0.0 <2.0.0

## Package README (untrusted upstream documentation)
w_transport [![Build Status](https://travis-ci.org/Workiva/w_transport.svg?branch=travis-ci)](https://travis-ci.org/Workiva/w_transport)
===========

> A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.

---

## Platform Agnostic
The main library (`w_transport/w_transport.dart`) depends on neither `dart:html` nor `dart:io`, making it platform agnostic.
This means you can use the `w_transport` library to build components, libraries, or APIs that will be reusable in the browser
AND on the server.

The end consumer will make the decision between client and server, most likely in a main() block.

## Usage in the Browser
```dart
import 'package:w_transport/w_transport_client.dart' show configureWTransportForBrowser;

void main() {
  configureWTransportForBrowser();
}
```

## Usage on the Server
```dart
import 'package:w_transport/w_transport_server.dart' show configureWTransportForServer;

void main() {
  configureWTransportForServer();
}
```

---

## HTTP

All standard HTTP methods are supported:

- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
- TRACE (only on the server)

Features include:

- Fluent URI construction/mutation thanks to [Fluri](https://pub.dartlang.org/packages/fluri).
- Request headers.
- Easy attachment of various data types to requests.
- Upload and download progress streams.
- Sending of credentials on cross-origin requests (`withCredentials` flag - only has an effect on the client).
- Request cancellation.


## WHttp
`WHttp` acts as an HTTP client that can be used to send many HTTP requests. Client-side this has no effect, but on the
server this gives you the benefit of cached network connections.

Additionally, `WHttp` has static methods that make simple HTTP requests easy.

```dart
WHttp.get(Uri.parse('example.com'));
WHttp.post(Uri.parse('example.com'), 'data');
...
```

If you do create an instance of `WHttp`, make sure you close it when finished.

```dart
WHttp http = new WHttp();
...
http.close();
```


## WRequest
`WRequest` is the class used to create and send HTTP requests. It supports headers, request data, upload & download
progress monitoring, withCredentials (only useful in the browser), and request cancellation.


## WResponse
`WResponse` is the class that contains the response to a `WRequest`.

This includes response meta data (available synchronously):

- Response headers
- Status code (200)
- Status text ('OK')

As well as the response content in the following formats (available asynchronously):

- Dynamic object (ByteBuffer, Document, String, List<int>, etc.)
- Text (decoded and joined if necessary)
- Stream


## WProgress
`WProgress` is a simple class that mimics `ProgressEvent` with an additional `percent`
property for convenience. `WProgress` is platform-agnostic, unlike `ProgressEvent`.


## WHttpException
`WHttpException` is a custom exception that is raised when a request responds with a non-successful status code.
## Changelog







 
