packages start...
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
## http
|
||||
|
||||
Das Http-Paket stellt eine fetch Methode zur Verfügung, die eine HTTP-Anfrage ausführt und eine Antwort zurückgibt. Sie nimmt eine URL und optionale Parameter wie Methode (GET, POST, usw.), Header, Körper und Timeout als Argumente entgegen.
|
||||
|
||||
```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