Go HTTP implementation with a focus on performance. Use this for tags about using the fasthttp API.
Questions tagged [fasthttp]
53 questions
1
vote
1 answer
How to register new websocket connections gofiber
I'm trying to set up a simple websocket server that should serve the client some content at unknown intervals.
My code currently looks like this:
router.go
func SetupRoutes(app *fiber.App) error {
app.Get("/whop/validate",…

Fergus Johnson
- 183
- 11
1
vote
0 answers
EKS - Restarting or Deleting a Pod of Go cobra/fasthttp helloworld for a K8s service kills service nodeport on worker group instance
I have a simple k8s NodePort Service linked to a k8s deployment of a single pod hosting a hello world go program that basically uses cobra to spin up a fasthttp server. If the pod of that deployment restarts or get deleted (and a new one spins up),…

Derick F
- 2,749
- 3
- 20
- 30
1
vote
1 answer
fasthttp websocket: panic nil: websocket.(*Conn).beginMessage()
Using Fiber v2.38.1, which in turn use fasthttp/websocket v1.5.0.
App crashed with following error:
2022-10-15T04:05:42.983563+00:00 app[web.1]: time="2022-10-15T04:05:42Z" level=info msg="close msg received: &{418…

Eric
- 22,183
- 20
- 145
- 196
1
vote
1 answer
error "data1.Body undefined (type []byte has no field or method Body)" when trying to decode a json's body
So again im trying to get this data but it is returning an error of
data.Body undefined (type []byte has no field or method Body)
on line 16 and 23 of this code. so when its decoding the json
If anyone could help me,
here is my code
func…

Ultimate
- 43
- 1
- 11
1
vote
1 answer
Locust FastResponse's failure attribute doesn't set request as failed in report
I have such task in locustfile:
class Tasks(FastHttpUser):
headers = {'content-type': 'application/json', 'Connection': 'close'}
@task
def task(self):
payload = "some data"
try:
with…

Samolevar
- 53
- 7
1
vote
1 answer
Upload a file with greater dimension than DefaultMaxRequestBodySize in fasthttp
I can not find an example for upload a file with greater dimension than the DefaultMaxRequestBodySize. Could you please share how to upload a big file using fasthttp?
Unfortunately, I receive the error body size exceeds the given limit.

alessiosavi
- 2,753
- 2
- 19
- 38
1
vote
0 answers
Goroutines for gRPC calls
I am trying to do a small prototype for a gRPC proxy service (based on github.com/buaazp/fasthttprouter ) which make calls to a gRPC backend
My prototype is based on gRPC helloworld example:
package main
import (
pb "../proto/helloworld"
…

Ali Mamedov
- 5,116
- 3
- 33
- 47
1
vote
2 answers
Define parameters as param request instad of endpoint url in fasthttprouter
I am using golang´s fasthttprouter and have followed the examples and defined a router like this:
router.GET("/customer/account/detail/:accountId", myHandler.customerAccountDetailHandler)
Then I call to my service as…

antonof
- 109
- 1
- 8
1
vote
2 answers
Unable to set cookie for golang's fasthttp framework
I trying to set the cookie from the server using fasthttp framework. But the cookie value is not set properly in the response header. I don't know what I have missed in the below snippet.
package main
import (
"log"
…

sprabhakaran
- 1,615
- 5
- 20
- 36
1
vote
1 answer
How to get query arguments from RequestURI without losing character
I want to get the query arguments from RequestURI in golang.
The URL is like that:
http://localhost:3000/add-ebay?authToken=AgAAAA**AQAAAA**aAAAAA**6d8JWQ**nY+sHZ2PrBmdj6wVnY+sEZ2...
And my code is followings:
func CreateEbayProfile(ctx…

Alakey
- 21
- 6
0
votes
0 answers
Inconsistent routing in Go fasthttp with fasthttp/router
I am working on a Go server that uses FastHTTP with github.com/fasthttp/router routing package. But I have been experiencing routing inconsistencies with it. I tried every fork of the fasthttp/router package and I am having problems with every…

Dev-Siri
- 592
- 5
- 22
0
votes
0 answers
Go: How to read from ctx.PostBody() and turn []byte into string?
How to read from ctx.PostBody() key and value?
I am using fasthttp package instead of http/net and posting from Postman the value of url
postmans result
fmt.Fprintln(ctx, string(ctx.PostBody()))
var link = ctx.PostBody()
rawBodyAsString :=…

DiggityDank
- 11
- 3
0
votes
0 answers
How to unit test fasthttp-router handler properly?
I am trying to write unit test for my app. I am using fasthttp lib. I also use fasthttp-routing lib. So the problem is that my handler is not standard type of fasthttp.HandlerFunc but routing.Handler.
In order to test HTTP handlers i've written the…

Максим Панчук
- 11
- 1
0
votes
1 answer
How to change which IP address a go-fiber client is using?
I'm using Fiber as an HTTP client to make some requests to an http server, however I'm being rate limited. On my vm I configured 5 different IP addresses (public/private) and have confirmed that they are indeed connected to the internet.
curl…

Benjamin Kosten
- 361
- 2
- 12
0
votes
2 answers
How to parse POST request body with arbitrary number of parameters in Go Fiber/ fasthttp
type Person struct {
Name string `json:"name" xml:"name" form:"name"`
Pass string `json:"pass" xml:"pass" form:"pass"`
}
app.Post("/", func(c *fiber.Ctx) error {
p := new(Person)
if err := c.BodyParser(p); err != nil {
…

AH.
- 741
- 1
- 12
- 27