@whatwg-node/server
Advanced tools
Comparing version 0.4.0-alpha-20220916163145-ea58ba1 to 0.4.0-alpha-20220916163416-8c6abfa
@@ -264,3 +264,5 @@ 'use strict'; | ||
has: (_, prop) => { | ||
return prop in adapterObj || prop in genericRequestHandler || (serverAdapterBaseObject && prop in serverAdapterBaseObject); | ||
return (prop in adapterObj || | ||
prop in genericRequestHandler || | ||
(serverAdapterBaseObject && prop in serverAdapterBaseObject)); | ||
}, | ||
@@ -267,0 +269,0 @@ get: (_, prop) => { |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.4.0-alpha-20220916163145-ea58ba1", | ||
"version": "0.4.0-alpha-20220916163416-8c6abfa", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -16,3 +16,3 @@ # WHATWG Node Generic Server Adapter | ||
export default createServerAdapter((request: Request) => { | ||
return new Response(`Hello World!`, { status: 200 }) | ||
return new Response(`Hello World!`, { status: 200 }) | ||
}) | ||
@@ -206,18 +206,18 @@ ``` | ||
const myServerAdapter = createServerAdapter(async request => { | ||
// Parse the request as `FormData` | ||
const formData = await request.formData() | ||
// Select the file | ||
const file = formData.get('file') | ||
// Process it as a string | ||
const fileTextContent = await file.text() | ||
// Select the other text parameter | ||
const regularTextData = formData.get('additionalStuff') | ||
// ... | ||
return new Response('{ "message": "ok" }', { | ||
status: 200, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}) | ||
// Parse the request as `FormData` | ||
const formData = await request.formData() | ||
// Select the file | ||
const file = formData.get('file') | ||
// Process it as a string | ||
const fileTextContent = await file.text() | ||
// Select the other text parameter | ||
const regularTextData = formData.get('additionalStuff') | ||
// ... | ||
return new Response('{ "message": "ok" }', { | ||
status: 200, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}) | ||
}) | ||
``` | ||
@@ -224,0 +224,0 @@ |
Sorry, the diff of this file is not supported yet
37065
649