fasthttp

Get a request parameter key-value in fasthttp

喜欢而已 提交于 2020-01-25 06:10:18
问题 http://127.0.0.1:8080/x?haha=1 I want to get something like ctx.QueryArgs().Get("haha") is it possible in golang's fasthttp package? 回答1: Found it ctx.QueryArgs().Peek("haha") The naming choice is unexpected. 回答2: You can retrieve a custom GET, POST PUT parameter using FormValue method: - GET (Query String such as ?user=a&pass=b); - POST, PUT body Literally, from the documentation: FormValue returns form value associated with the given key. The value is searched in the following places: Query

Combining net/http and fasthttp

时光总嘲笑我的痴心妄想 提交于 2020-01-17 15:00:20
问题 I was looking for a fast framework for go and I stumbled upon fasthttp https://github.com/valyala/fasthttp which is according to the developer and the benchmark is 10x faster than Golang net/http package. I'm already familiar with gorilla toolkit and other net/http based frameworks like gin-gonic, goji, and gocraft. My question is: Is it possible to mix net/http framework / toolkits with fasthttp for example I would like to use some gorilla packages with echo / iris (fasthttp frameworks)? 回答1

why is fasthttp like single process?

有些话、适合烂在心里 提交于 2019-12-14 03:37:23
问题 requestHandler := func(ctx *fasthttp.RequestCtx) { time.Sleep(time.Second*time.Duration(10)) fmt.Fprintf(ctx, "Hello, world! Requested path is %q", ctx.Path()) } s := &fasthttp.Server{ Handler: requestHandler } if err := s.ListenAndServe("127.0.0.1:82"); err != nil { log.Fatalf("error in ListenAndServe: %s", err) } multiple request,and it cost time like X*10s. fasthttp is single process? after two days... I am sorry for this question,i describe my question not well.My question is caused by