backend & types
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
## http
|
||||
|
||||
Das HttpPackage-Interface bietet Funktionen zum Senden von HTTP-Anfragen. Es enthält die folgende Methode:
|
||||
|
||||
- `fetch(url: string, options?: {}): {}`:
|
||||
Diese Methode nimmt eine URL und optionale Anforderungsoptionen entgegen und sendet eine HTTP-Anfrage an die angegebene URL. Die Optionen können die HTTP-Methode, Header, den Body und das Timeout steuern. Die Methode gibt ein Objekt zurück, das den Status, den StatusText, die Header, den Trailer, die URL und den Body der Antwort enthält.
|
||||
|
||||
```ts
|
||||
interface HttpPackage {
|
||||
/**
|
||||
* http request
|
||||
*
|
||||
* @param url url for request
|
||||
* @param options request options
|
||||
*/
|
||||
fetch(
|
||||
url: string,
|
||||
options?: {
|
||||
method?: string
|
||||
headers?: { [key: string]: string }
|
||||
body?: string
|
||||
// timeout in seconds
|
||||
timeout?: number
|
||||
}
|
||||
): {
|
||||
status: number
|
||||
statusText: string
|
||||
headers: { [key: string]: string }
|
||||
trailer: { [key: string]: string }
|
||||
url: string
|
||||
body: {
|
||||
text(): string
|
||||
json(): any
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user