http_test.ts
See original GitHub issuechrome is ok but curl and firefox never response
./deno_osx_x64 --version
deno: 0.1.12
v8: 7.1.302.4
typescript: 3.1.6
import { serve } from "https://deno.land/x/net/http.ts";
const addr = "127.0.0.1:8090";
const s = serve(addr);
console.log(`listening on http://${addr}/`);
const body = (new TextEncoder()).encode("Hello World\n");
async function main() {
for await (const req of s) {
await req.respond({ status: 200, body });
}
}
main();
curl http://127.0.0.1:8090/
curl: (56) Recv failure: Connection reset by peer
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
pxt-HTTP-MQTT/httpTest.ts at master · DFRobot/pxt-HTTP ... - GitHub
pxt-HTTP-MQTT/httpTest.ts. Go to file · Go to file T; Go to line L; Copy path; Copy permalink. This commit does not belong to...
Read more >httptest - PyPI
HTTP testing inspired by golang's httptest package. Supports wrapping asyncio coroutine functions ( async def ). Usage. Context Manager. import unittest import ...
Read more >The awesomeness of the httptest package in Go
This article explains how to use the httptest package to mock HTTP servers and to test ... Fprintln(w, "I am a super server")...
Read more >httptest - The Go Programming Language - GitHub Pages
Overview ▾. Package httptest provides utilities for HTTP testing. ... Get(ts.URL) if err != nil { log.Fatal(err) } greeting, err := ioutil.ReadAll(res.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey - sorry for the late reply to this.
http.ts
is only half-implemented, as you can tell. It needs someone (probably me) to dig in and complete it. Help welcome - but otherwise you’ll have to wait a few weeks. Ultimately we’ll probably use a native http parser - this was added so we can benchmark what sort of overhead parsing in pure JS has (also just as some example code for people to look at)When using a browser to access, 2 requests were sent at the same time
For some reason (probably a bug), deno has not received
EOF
, cause Conn to not close. When using curl, can always receiveEOF
, so c.close() has been invoked.