@fastly/as-fetch
Version:
 
135 lines (71 loc) • 2 kB
Markdown
[@fastly/as-fetch](../README.md) / Request
# Class: Request
A [Fetch HTTP Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) Object.
## Hierarchy
- [Body](body.md)
↳ **Request**
## Table of contents
### Constructors
- [constructor](request.md#constructor)
### Accessors
- [bodyUsed](request.md#bodyused)
- [headers](request.md#headers)
- [method](request.md#method)
- [url](request.md#url)
### Methods
- [arrayBuffer](request.md#arraybuffer)
- [text](request.md#text)
## Constructors
### constructor
• **new Request**(`url`, `init`)
The constructor for an HTTP Request.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `url` | `string` | The url for where the Request should be sent. |
| `init` | [RequestInit](requestinit.md) | The Request configuration object. |
#### Overrides
[Body](body.md).[constructor](body.md#constructor)
## Accessors
### bodyUsed
• `get` **bodyUsed**(): `boolean`
#### Returns
`boolean`
A boolean representing whether the Body has been consumed already or not.
___
### headers
• `get` **headers**(): [Headers](headers.md)
Get the Request headers.
#### Returns
[Headers](headers.md)
A `Headers` object of the HTTP Request headers, for the `Request`.
___
### method
• `get` **method**(): `string`
Get the Request method.
#### Returns
`string`
A string representation of the HTTP request method.
___
### url
• `get` **url**(): `string`
Get the Request URL.
#### Returns
`string`
A string representation of the HTTP Request URL.
## Methods
### arrayBuffer
▸ **arrayBuffer**(): ``null`` \| `ArrayBuffer`
#### Returns
``null`` \| `ArrayBuffer`
an `ArrayBuffer` for the Body content (if it contains one).
#### Inherited from
[Body](body.md).[arrayBuffer](body.md#arraybuffer)
___
### text
▸ **text**(): `string`
#### Returns
`string`
a string representation of the Body `ArrayBuffer` content.
#### Inherited from
[Body](body.md).[text](body.md#text)