Skip to content

Commit 28589a3

Browse files
committed
Add 'Inspecting The Request' to the README
1 parent 5b49368 commit 28589a3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,24 +394,44 @@ const devices = await seam.client.get<DevicesListResponse>('/devices/list')
394394
An Axios compatible client may be provided to create a `SeamHttp` instance.
395395
This API is used internally and is not directly supported.
396396

397+
#### Inspecting the Request
398+
399+
It is possible to inspect a request before it is sent. All of the client methods return an instance of `SeamHttpRequest` which has `url`, `method` and `data` properties. The request is only sent to the server when the `SeamHttpRequest` is awaited.
400+
401+
```ts
402+
const seam = new SeamHttp('your-api-key')
403+
404+
const request = seam.devices.list()
405+
406+
console.log('Sending request', request.url, request.method, request.data)
407+
408+
const devices = await request // or `await request.execute()` if you prefer
409+
410+
console.log(devices)
411+
```
412+
397413
## Development and Testing
398414

399415
### Quickstart
400416

401417
```
418+
402419
$ git clone https://github.com/seamapi/javascript-http.git
403420
$ cd javascript-http
404421
$ nvm install
405422
$ npm install
406423
$ npm run test:watch
424+
407425
```
408426

409427
Primary development tasks are defined under `scripts` in `package.json`
410428
and available via `npm run`.
411429
View them with
412430

413431
```
432+
414433
$ npm run
434+
415435
```
416436

417437
### Source code
@@ -420,7 +440,9 @@ The [source code] is hosted on GitHub.
420440
Clone the project with
421441

422442
```
443+
423444
$ git clone [email protected]:seamapi/javascript-http.git
445+
424446
```
425447

426448
[source code]: https://github.com/seamapi/javascript-http
@@ -433,19 +455,25 @@ Be sure that all commands run under the correct Node version, e.g.,
433455
if using [nvm], install the correct version with
434456

435457
```
458+
436459
$ nvm install
460+
437461
```
438462

439463
Set the active version for each shell session with
440464

441465
```
466+
442467
$ nvm use
468+
443469
```
444470

445471
Install the development dependencies with
446472

447473
```
474+
448475
$ npm install
476+
449477
```
450478

451479
[Node.js]: https://nodejs.org/
@@ -471,7 +499,9 @@ The `version` input will be passed as the first argument to [npm-version].
471499
This may be done on the web or using the [GitHub CLI] with
472500

473501
```
502+
474503
$ gh workflow run version.yml --raw-field version=<version>
504+
475505
```
476506

477507
[GitHub CLI]: https://cli.github.com/
@@ -528,3 +558,7 @@ loss of use, data, or profits; or business interruption) however caused and on
528558
any theory of liability, whether in contract, strict liability, or tort
529559
(including negligence or otherwise) arising in any way out of the use of this
530560
software, even if advised of the possibility of such damage.
561+
562+
```
563+
564+
```

0 commit comments

Comments
 (0)