Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
142 views

I'm building a Go web server that serves static files using TDD. When I run my server and access /static/index.html in the browser, it works fine and returns the file. However, when I run my test ...
Harris's user avatar
  • 19
0 votes
0 answers
89 views

I am trying to see whats the best practice for configuring go http client. We recently had a load balancer node of a dependency go down and the node was replaced with same ip. However we see that ...
Amulya's user avatar
  • 11
1 vote
1 answer
145 views

The docs for http.Client.Timeout says: The timeout includes connection time, any redirects, and reading the response body The docs for http.Transport.MaxConnsPerHost says: MaxConnsPerHost optionally ...
bobbuilder's user avatar
1 vote
1 answer
259 views

I'm trying to send some cookies up with a request from some Go code I'm writing, and it seemingly does not work with localhost cookies. Is there an option or something that needs to be done to make ...
Bill L's user avatar
  • 2,856
0 votes
1 answer
428 views

Issue It seems that the HTTP Client is sending a different message than the Payload I want to send to the server. In the sample code, you can see that the Payload passed to http.NewRequest is a ...
Yasuhiro Yamazaki's user avatar
0 votes
1 answer
273 views

I have a go-chi (golang) web application that is hosted behind nginx (reverse proxy - proxy_pass directives), that accepts file uploads that are then uploaded to AWS S3. The request with a file is ...
exception_thrown's user avatar
1 vote
1 answer
281 views

I'm building an HTTP client in Go and I need to make calls to an endpoint via a proxy server. The proxy address is not fixed, so I'm currently creating a new http.Client instance every time I need to ...
ray an's user avatar
  • 1,280
1 vote
2 answers
131 views

I am trying to make an application that periodically sends data to a client's browser, unitl the client's browser closes. My problem is, that I am unable to detect client closing the browser. I have ...
Atom's user avatar
  • 52
1 vote
1 answer
747 views

I am using the net/http standard library package for subrouting in Golang while developing a simple API. However, I encountered a problem. I have user routes for registration with POST /v1/users/. ...
Rohit Patil's user avatar
1 vote
1 answer
136 views

I recently built a small blog website for testing purposes and I'm a little stuck with this problem while writing the server in Go. I have all the files of the website inside the static folder, which ...
NicolaM94's user avatar
  • 161
1 vote
2 answers
589 views

I am writing an API using go-chi and my endpoint can be authenticated either via Basic Auth or an API Key. How can I compose two independently functioning middlewares? Here is what the router looks ...
poundifdef's user avatar
  • 19.5k
1 vote
0 answers
1k views

We are facing the issue of SSRF vulnerability in http.NewRequestWithContext(ctx, "GET", url, nil) function in Golang during Veracode scan. The URL that is coming to this function contains ...
Kirti Dhiman's user avatar
-1 votes
1 answer
64 views

I'm using a request bin (running on localhost:8080/anything) to capture what my application sends (kennethreitz/httpbin) so now i have two similar POST requests using two different user agents, which ...
Yadhu's user avatar
  • 3,335
1 vote
0 answers
62 views

I am scanning IP addresses in a network (where I am VPN'ed). func scanTestHandler(c *gin.Context) { var ipRanges ScanApiBody decoder := json.NewDecoder(c.Request.Body) if err := decoder....
muezz's user avatar
  • 57
-1 votes
1 answer
481 views

The "net/http" golang package has a response type which I find confusing. It defines a member Body io.ReadCloser which requires an additional call to some form of an io writer to process. ...
EnnFour's user avatar
  • 337
1 vote
0 answers
269 views

BACKGROUND I created a simple http webserver in go. Below is a snippet of the code where *Static, Addr and port are the frontend files, the server address, and the port respectively func ...
szs's user avatar
  • 111
2 votes
1 answer
384 views

I've been trying to set up an HTTP server in Go that allows users to upload files via HTML forms. This form would also have a text input for other reasons. However, upon submitting the form, my ...
LukeAtmi's user avatar
  • 169
4 votes
1 answer
2k views

My objective is to upload a big file to POST https://somehost/media using golang's builtin net/http package. HTTP format of the Api call POST /media HTTP/1.1 Host: somehost Content-Length: 434 Content-...
vkstack's user avatar
  • 1,674
1 vote
1 answer
2k views

I'm trying to calculate a report independently of an HTTP request using the Gin framework, but I also want to return it to the request if it hasn't been closed yet. The following code snippet ...
icsarisakal's user avatar
1 vote
0 answers
408 views

According to http.Client and http.Transport documentation in Go's built-in net/http package: // The Client's Transport typically has internal state (cached TCP // connections), so Clients should be ...
Colduction's user avatar
1 vote
0 answers
101 views

In a recent project, I came across a requirement to simultaneously listen on multiple sets of ports with different routes, and have the ability to control the open/close status of each listening group....
lvyonghuan's user avatar
0 votes
1 answer
1k views

When making a http Get request in Go, it waits the full timeout time before returning an error, even when there is no network connection. I assume in the internals it knows pretty quickly it has ...
scosman's user avatar
  • 2,603
1 vote
1 answer
2k views

For debugging purposes, how can I get more information on exactly where my http.TimeoutHandler wrapped handler canceled an active http.Request::Context()? Ideally, a stacktrace should be logged. ...
maxschlepzig's user avatar
  • 40.1k
2 votes
0 answers
213 views

I want to use the embed features in Golang but I can't link up the CSS style to the HTML. I tried to find more information to see what I do wrong, but I could not find any help. main.go package main ...
Belin's user avatar
  • 33
1 vote
1 answer
130 views

Im trying to upload images from my Golang backend to imagekit via the imagekit sdk. Im facing problems with understanding what the context api is used for. Currently I don't really use context in my ...
pirmin_b's user avatar
1 vote
0 answers
180 views

I am developing a simple automation tool using a Go Fiber HTTP server to start and stop AWS instances using the Go SDK v1.44.156. The service listens to an endpoint at /csm/aws/:region/:instance_id/...
DevAbdurrahman's user avatar
0 votes
0 answers
388 views

I need to pass csrf cookies _gorila_csrf and csrf_token from my HEAD-Request to my POST-Request. What is the best practice for that? For now I get the Cookie Value with res.Cookies() for the two ...
sokolata's user avatar
  • 549
2 votes
1 answer
1k views

Supposed that I'm writing an http handler, that do something else before returning a response, do I have to setup a listener to check wether the http request context has been canceled? so that it can ...
Riki Syahputra's user avatar
1 vote
0 answers
224 views

I'm a green hand with Go. I have a problem with this code.` package main import ( "fmt" "log" "net/http" ) func main() { mux := http.NewServeMux() mux....
David Lee's user avatar
2 votes
1 answer
607 views

How can I compose the default Go HTTP file server (serve if exists, show file listing otherwise) with additional HTML? Sample http.go with default file server: package main import "net/http"...
ubndpdhsc's user avatar
1 vote
1 answer
787 views

I've implemented http reverse proxy middleware which used with Gin framework app: app := gin.New() app.Use(proxy.ReverseProxy("127.0.0.1:8008")) // HERE I'm attaching ReverseProxy ...
num8er's user avatar
  • 19.5k
1 vote
2 answers
461 views

I am trying to call an API so the thing is when I am trying to call it from Postman with "Follow original HTTP method" on it's working fine but on disabling it giving a 400-Bad request ...
aakash singh's user avatar
2 votes
1 answer
1k views

I am new to GoLang and working on my first API. I have two endpoints, and I want to rate limit only one of them. I found a helpful tutorial to get me started, and I've based my approach off of the ...
John Harrington's user avatar
1 vote
1 answer
630 views

I'm trying to create a Student Attendance web app. Currently have a struct type Student struct { StudentID int StudentName string Created time.Time } All student will be listed on list....
Awesome Lerman's user avatar
1 vote
1 answer
2k views

I am running an api using elasticsearch, go, and docker. I have an image for elasticsearch, and an image for the HTTP server scheme. I should be able to run docker-compose up, however for whatever ...
Evan Hassan's user avatar
0 votes
1 answer
380 views

I am developing a server application with the net/http package. Everytime a request arrives, the net/http package reads the request and create a http.Request object. My server needs to call AWS ...
codewarrior's user avatar
  • 1,090
0 votes
0 answers
84 views

In flask, I do from flask import request route = request.url_rule.rule if request.url_rule else request.path So that I can get the "original" URL registered in Blueprint. For example, when ...
romlym's user avatar
  • 657
1 vote
1 answer
2k views

To create an outgoing POST request, func NewRequest() from net/http library is used. request body is parsed as a param. After request is created I set request headers using Set() func. After setting ...
Myat Su Phyo's user avatar
1 vote
1 answer
1k views

I am trying to verify if the go-retryablehttp execution performs retries as per the specified config. The verification methodology is to create a test that creates a retryable client creates a new ...
Ronak Agrawal's user avatar
0 votes
1 answer
3k views

My go application can upload and remove objects from a Minio server on the same docker network but statObject and getObject return empty information. The file does exist in the minio console. Here is ...
markhorrocks's user avatar
  • 1,610
5 votes
1 answer
4k views

I have a go API which so far has always returned JSON. I use chi router and set it up using middleware like this in my main function: func router() http.Handler { r := chi.NewRouter() r.Use(render....
markhorrocks's user avatar
  • 1,610
1 vote
2 answers
168 views

Hey there just started to transform my python code to Go, but have some issue on the json manipulations... here is my code so far package test import ( "encoding/json" "fmt&...
itasli's user avatar
  • 23
-2 votes
1 answer
901 views

I'm building an API that scrapes some data off a webpage. To do so, i need to send a GET request to a home page, scrape a 'RequestVerificationToken' from the HTML, then send another POST request to ...
SumitN's user avatar
  • 23
3 votes
0 answers
869 views

I am using Go Chi with a custom handler function that returns an error. Ideally I want to write a middleware function that uses my custom handler function and return an error that will eventually need ...
Corbuk's user avatar
  • 720
0 votes
1 answer
301 views

Is there something like the traceEnable parameter in apache, in golang net/http? I do have something like the following, but I do want to listen to GET, POST and HEAD, however not to the TRACE method ...
Hons's user avatar
  • 4,076
1 vote
3 answers
2k views

I'm using the net/http package and wondering how I can exit the handler from anywhere in the code. Say I have this code: func main() { http.HandleFunc("/", handler) http....
Jon Flynn's user avatar
  • 470
1 vote
0 answers
425 views

I have a use case where I want to use an HTTP client in Go with pooled connections (connection re-use), but with the special case where a connection is intentionally closed (not allowed for re-use) if ...
Jordan's user avatar
  • 4,650
1 vote
1 answer
1k views

I have a long running GO program(version 1.18) which sends hundreds of GET requests simultaneously per second using RESTY to the remote https://api.abcd.com. Each GET request is a separate go-routine ...
PerfectCompanion Me's user avatar
2 votes
1 answer
952 views

I have a set of SOCKS proxies, which are sitting behind a load balancer (an AWS Network Load Balancer, to be specific). When the load balancer receives a request on the SOCKS port, it forwards the ...
Jordan's user avatar
  • 4,650
2 votes
0 answers
815 views

I'm trying to proxy a request through Go's net/http package. I copy the http.Request object, send that, and a receive an http.Response object. I want to copy everything from that http.Response object ...
4343's user avatar
  • 39