Questions tagged [go-http]

This tag is for questions related to Go's HTTP package

Go's net/http package provides HTTP client and server implementations.

67 questions
0
votes
0 answers

How to fix net/http: HTTP/1.x transport connection broken: malformed HTTP response

Whenever I try to do a GET requests for google.com I get this error: Get "https://www.google.com/": net/http: HTTP/1.x transport connection broken: malformed HTTP response I want to try to get the homepage for google and I don't know why this is…
jjboi8708
  • 13
  • 5
0
votes
1 answer

The right data is not getting to Twilio

I am trying to make an API call to Twilio with Go's HTTP package and it appears the right data is not getting to Twilio. Request: func startVerification() (string, error) { url :=…
X09
  • 3,295
  • 8
  • 41
  • 80
0
votes
1 answer

Serve static file from within a group with Gin

I want to server static file by mapping /fs to filesys in the disk. I can server static file like this: r := gin.New() r.Use(static.Serve("/fs", static.LocalFile("./filesys", false))) // followed by other routes definition such as R.GET() I also…
huggie
  • 15,393
  • 21
  • 74
  • 128
0
votes
1 answer

Integration of Echo web framework with existing Gorilla Mux API

I am wanting to move to the echo framework for my API due to an openapi package we wish to use (opai-codegen) However our current API is built via gorilla mux. Due to the size of the current codebase we need to run them both side by side. So I am…
utx0_
  • 542
  • 3
  • 15
0
votes
1 answer

Github Your access to this site has been restricted in Go Http client

I'm running into an issue when using Go's http client to download a zip or tar.gz file from Github. I get a 403 with the message "Your access to this site has been restricted". Curl works fine though. I am running this in an EC2 instance on AWS in…
Vafilor
  • 55
  • 6
0
votes
0 answers

Connect with https url using .crt and .key

I have to connect with https url and I am provided with .crt, .key and .csr file. I am trying using code: caCert, err := ioutil.ReadFile("file1.crt") if err != nil { fmt.Println("error in read crt") fmt.Println(err) } …
anujprashar
  • 6,092
  • 6
  • 44
  • 79
0
votes
1 answer

Handling custom 404 pages with http.FileServer

I'm currently using a basic http.FileServer setup to serve a simple static site. I need to handle 404 errors with a custom not found page. I've been looking into this issue quite a bit, and I cannot determine what the best solution is. I've seen…
Luke Johnson
  • 103
  • 10
0
votes
0 answers

Seing http2 RST_STREAM frame with ErrorCode CANCEL

Seeing RST_STREAM with CANCEL being sent from client to server for some streams. Have added two stream data where in one case seeing RST_STREAM and in another not. HTTP2 Stream where RST_STREAM is seen No. Time Source …
swamydkv
  • 17
  • 9
0
votes
1 answer

Middleware HTTP test passing when it shouldn't

I've written some middleware that checks to make sure a JWT token in valid: func JwtVerify(next http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { //Get the token from the header …
Tom Withers
  • 1,103
  • 2
  • 15
  • 26
0
votes
0 answers

Use custom IP for a Domain without using built in DNS Resolver (while using Proxy) in Go

I am developing an application that has to connect through a HTTP Proxy and then use that Connection to do a GET Request to a domain name. The Domain Name should be resolved manually e.g. giving it the IP it should dial. Exactly thats the issue im…
0
votes
0 answers

Make HTTP 1.0 Request in Go

is there any way to make a HTTP 1.0 Request ? Go always reverts to using HTTP 1.1 I have tried setting the request.Proto to HTTP 1.0 but it didnt change anything
0
votes
1 answer

Prevent Open URL Redirect from gorilla/mux

I am working on a RESTful web application using Go + gorilla/mux v1.4 framework. Some basic security testing after a release revealed an Open URL Redirection vulnerability in the app that allows user to submit a specially crafted request with an…
0
votes
1 answer

How to mock many urls to return fixture content?

I'm writing some kind of a recursive parser. The simplest form is: Take all links from first link's page body Repeat the first step for each link So now I want to test it. The problem is I can't figure out the best way to mock all these pages. I…
Stanislav
  • 27
  • 2
  • 4
0
votes
2 answers

http host and port information in HandleFunc

I am try to start multiple http servers listening on different ports in same package. In my test HandleFunc function I need to print our host and the port of information of the http server which served the request. How would I do that? Here is my…
Dinesh Gowda
  • 694
  • 3
  • 7
  • 24
0
votes
1 answer

Serve files from a different directory when request comes to root directory

I am having some trouble serving some files from a subdirectory when a client request comes in at the root directory. I am using gorilla/mux to serve files. Here is my code below: package main import ( "log" "net/http" "time" …
zhughes3
  • 347
  • 5
  • 18