Skip to main content

All Questions

Tagged with
0 votes
0 answers
23 views

Go Create Http requests with Proxy [duplicate]

I have some code that uses a worker pool to request some API endpoints. Given a proxy in the format "IPADDR:PORT:USERNAME:PASSWORD" how can I create the request through this proxy? The proxy ...
Ahmed Zaidan's user avatar
-3 votes
0 answers
42 views

Why does Go create a TCP connection but not send an HTTP request? [closed]

I am using Go to make HTTP requests. When capturing packets with tcpdump, I found that after the TCP handshake is successful, the HTTP request is not sent immediately. After about 60 seconds, Nginx ...
zero's user avatar
  • 3
-4 votes
1 answer
70 views

Does overriding c.Request.Body with io.NopCloser in a Gin middleware cause potential data leaks?

I'm writing a middleware in Gin to log the request body for debugging purposes. In order to read the body multiple times, I need to use io.NopCloser to reassign c.Request.Body. Here's my current ...
Vũ Khoa's user avatar
1 vote
1 answer
43 views

Go jwt.ParseWithClaims issue

func ValidateJWT(tokenString, tokenSecret string) (uuid.UUID, error) { token, err := jwt.ParseWithClaims(tokenString, &jwt.RegisteredClaims{}, func(token *jwt.Token) (interface{}, error) { ...
黃柏瑋's user avatar
1 vote
1 answer
53 views

How to correctly mock API call in GO with httptest?

I have this function which uses an SDK package for Openstack. import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack" ) func ...
HC LW's user avatar
  • 197
1 vote
0 answers
36 views

how to define a nested slices in proto3

I use proto3 to generate api, my proto3 looks like message CreateSRPolicyDataRequest { repeated Path idc_paths = 1; } message Path { repeated string path = 1; } and it turns out "...
SimpleMiant's user avatar
1 vote
0 answers
53 views

Why does r.PathValue() not work for subrouters in Go 1.22?

I'm writing an API with some basic CRUD operations, and I'd like to be able to have my "photos" resource as a sub-resource of my "events" (i.e. requests are made against api/events/...
Recaptchow's user avatar
-1 votes
1 answer
112 views

Go http request, "read: connection reset by peer"

I read the answer in Go http.Get, concurrency, and "Connection reset by peer". I set the MaxConnsPerHost to equal the number of concurrent requests. But the same request comes again, read ...
xmh's user avatar
  • 135
1 vote
2 answers
116 views

Golang HTTP Handler -- is it possible to implement a call and response pattern within a single streaming POST?

I have very large sets of data on mobile and desktop clients that I am trying to bi-directionally sync with my website. I have currently setup a stream, where I am sending data up the server in chunks....
StainlessSteelRat's user avatar
0 votes
0 answers
63 views

proxy chain in golang

i want to setup a http proxy that proxy request to another http proxy that has authenticate. this proxy server will be used with selenium for chrome webdriver proxy because it dosent support ...
Mahdi Ramezaan zaade's user avatar
0 votes
0 answers
74 views

Golang Http Request With Certificate

I'm trying to do HTTP request with OpenSSL X509 Keypair, from the server side it's keep we always get forbidden ( 403 ) response, this is my code var pemFile string = "/etc/files/cert/pemFile.pem&...
ismailzakky's user avatar
1 vote
0 answers
139 views

How listen HTTPS and HTTP on same port depending on host with GO?

I'm writing a reverse proxy in go. I already have a basic setup working, but I want to be able to listen on a port and have it use TLS or not depending on the host. This is my current code: var ...
PortalGamesMais's user avatar
3 votes
0 answers
208 views

Can I read HTTP response with Transfer-Encoding=identity header in Golang?

Can I read HTTP response with Transfer-Encoding=identity header in Golang? Since at here shows that the official http library, net/http only support "chunked" in inbound Transfer-Encoding ...
haojie zhang's user avatar
1 vote
2 answers
389 views

logging HTTP 404/405 errors with Golang 1.22+ net/http ServeMux

I’m playing around with net/http after reading about the routing upgrades in 1.22, the goal here is to only use stdlib, so I'm intentionally avoiding frameworks and routers that are not part of the ...
Andrew Sirolly's user avatar
1 vote
0 answers
55 views

Zip file is created successfully whenever I use os.Create() but when I try to send the Zip file via HTTP Response I get gibberish data in Postman resp

This is my code that generates a ZIP file on the fly and writes a pdf (fetched from AWS S3 bucket) inside the ZIP file. If I write the ZIP file to the disk via os.create there is no issues but if I ...
Dhruv Dogra's user avatar

15 30 50 per page
1
2 3 4 5
124