This commit is contained in:
Bryan MacFarlane 2017-11-20 22:52:04 -05:00
Родитель 9a7f674a49
Коммит 3b7c044c2f
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -23,12 +23,18 @@ Intellisense and compile support from typing the REST calls:
npm install typed-rest-client --save
```
## Samples
See [samples](./samples) for complete coding examples
Also see [rest](./test/resttests.ts) and [http](./test/httptests.ts) tests for detailed examples.
## Errors
### http
The http client does not throw unless truly exceptional. A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
See [tests](./test/httptests.ts) for detailed examples.
See [http tests](./test/httptests.ts) for detailed examples.
### rest
The rest client is a high level client which uses the http client. It's responsibility is to turn a body into a serialized typed object.
@ -39,11 +45,7 @@ A 404 will not throw but the result object will be null and the result statusCod
Other 4xx and 5xx errors will throw. The status code will be attached to the error object. If a restfull error object is returned ({ message: xxx}), then the error message will be that. Otherwise, it will be a generic, "Failed Request: (xxx)".
See [tests](./test/resttests.ts) for detailed examples.
## Samples
See [samples](./samples) for complete coding examples
See [rest tests](./test/resttests.ts) for detailed examples.
## Contributing