import { serve } from "https://deno.land/std/http/server.ts" ; import { MultipartReader , isFormFile , FormFile , } from "https://deno.land/std/mime/mod.ts" ; import { path_to_url } from "../../lib/util/path_to_url.ts" ; const s = serve ( { port : 8000 } ) ; const decoder = new TextDecoder ( "gb2312" ) ; const encoder = new TextEncoder ( ) ; for await ( const req of s ) { const url = path_to_url ( req . proto , req . headers , req . url ) ; console . log ( url . href ) ; const method = req . method ; console . log ( method ) ; const contentType = req . headers . get ( "content-type" ) ; console . log ( contentType ) ; const body = await Deno . readAll ( req . body ) ; const json = decoder . decode ( body ) ; console . log ( json ) ; req . respond ( { body : "Hello" } ) ; }