feat(types): update @lune/net types to reflect buffer support

This commit is contained in:
Erica Marigold 2024-01-21 13:30:21 +05:30
parent 746b1cc271
commit 185fb6ae66
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -36,7 +36,7 @@ export type FetchParamsOptions = {
export type FetchParams = { export type FetchParams = {
url: string, url: string,
method: HttpMethod?, method: HttpMethod?,
body: string?, body: (string | buffer)?,
query: HttpQueryMap?, query: HttpQueryMap?,
headers: HttpHeaderMap?, headers: HttpHeaderMap?,
options: FetchParamsOptions?, options: FetchParamsOptions?,
@ -61,7 +61,7 @@ export type FetchResponse = {
statusCode: number, statusCode: number,
statusMessage: string, statusMessage: string,
headers: HttpHeaderMap, headers: HttpHeaderMap,
body: string, body: (string | buffer)?,
} }
--[=[ --[=[
@ -83,7 +83,7 @@ export type ServeRequest = {
query: { [string]: string? }, query: { [string]: string? },
method: HttpMethod, method: HttpMethod,
headers: { [string]: string }, headers: { [string]: string },
body: string, body: (string | buffer)?,
} }
--[=[ --[=[
@ -101,7 +101,7 @@ export type ServeRequest = {
export type ServeResponse = { export type ServeResponse = {
status: number?, status: number?,
headers: { [string]: string }?, headers: { [string]: string }?,
body: string?, body: (string | buffer)?,
} }
type ServeHttpHandler = (request: ServeRequest) -> string | ServeResponse type ServeHttpHandler = (request: ServeRequest) -> string | ServeResponse
@ -158,7 +158,7 @@ export type ServeHandle = {
export type WebSocket = { export type WebSocket = {
closeCode: number?, closeCode: number?,
close: (code: number?) -> (), close: (code: number?) -> (),
send: (message: string, asBinaryMessage: boolean?) -> (), send: (message: (string | buffer)?, asBinaryMessage: boolean?) -> (),
next: () -> string?, next: () -> string?,
} }