Skip to content

Commit 2ed7184

Browse files
committed
document optional url arg in request
1 parent 717186a commit 2ed7184

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/request.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
### API
2020

21-
`stream = m.request(options)`
21+
`stream = m.request([url,] options)`
2222

2323
Argument | Type | Required | Description
2424
---------------------- | --------------------------------- | -------- | ---
25+
`url` | `String` | No | If present, it's equivalent to having the options `{method: "GET", url: url}`. Values passed to the `options` argument override options set via this shorthand.
2526
`options.method` | `String` | Yes | The HTTP method to use. This value should be one of the following: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD` or `OPTIONS`.
2627
`options.url` | `String` | Yes | The URL to send the request to. The URL may be either absolute or relative, and it may contain [interpolations](#dynamic-urls).
2728
`options.data` | `any` | No | The data to be interpolated into the URL and serialized into the querystring (for GET requests) or body (for other types of requests).

docs/signatures.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ The **Required** column indicates whether an argument is required or optional. I
2727

2828
---
2929

30+
### Optional arguments
31+
32+
Function arguments surrounded by square brackets `[ ]` are optional. In the example below, `url` is an optional argument:
33+
34+
`m.request([url,] options)`
35+
36+
---
37+
3038
### Splats
3139

3240
A splat argument means that if the argument is an array, you can omit the square brackets and have a variable number of arguments in the method instead.

0 commit comments

Comments
 (0)