question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

chrome 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
rycommented, Nov 30, 2018

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)

1reaction
justjavaccommented, Nov 28, 2018

When using a browser to access, 2 requests were sent at the same time

GET / HTTP/1.1
GET /favicon.ico HTTP/1.1

For some reason (probably a bug), deno has not received EOF, cause Conn to not close. When using curl, can always receive EOF, so c.close() has been invoked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

net/http/httptest - Go Packages
Package httptest provides utilities for HTTP testing.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found