Questions tagged [gorequest]

8 questions
3
votes
0 answers

golang http net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x05\x00"

When I use golang's net/http package to request different web pages, I often get this error, because of what? (I used a proxy to crawl)
Developer
  • 39
  • 1
  • 2
1
vote
2 answers

Append raw Goreq.body response to file

Hi I would like to append a downloaded file raw response to a file. Supposed that I'm trying to download a 1GB file and download process will be done in multiple request. Let say 100mb per request. Now this all the 10 parts should be put into one…
MadzQuestioning
  • 3,341
  • 8
  • 45
  • 76
1
vote
2 answers

Request reroute in Go, map HandleFuncs

I want to map path names to files that live at a different location. But my code serves /path/c.txt when I visit /a, instead of /path/a.txt. What am I doing wrong? package main import ( "fmt" "net/http" ) func main() { fileRoutes :=…
stef
  • 313
  • 2
  • 12
1
vote
1 answer

POST with Go fails but works with curl

I've tested the following curl command against my app, and it returns successfully: curl --data "username=john&password=acwr6414" http://127.0.0.1:5000/api/login However trying to replicate the above in go has proven quite a challenge, I keep…
Jonathan
  • 10,792
  • 5
  • 65
  • 85
0
votes
1 answer

How to write an interface for a complex http client like gorequest with methods that returns itself for chaining

I'm writing a package which needs to pass an instance of a *gorequest.SuperAgent to a method in a subpackage // main.go func main() { req := gorequest.New() result := subpackage.Method(req) fmt.Println(result) } // subpackage.go func…
George Ananda Eman
  • 3,292
  • 8
  • 28
  • 29
0
votes
0 answers

Reuse same TCP connection in Golang using gorequest

Here I am trying to POST 20 docs to my webservice using gorequest, but it creates 20 different TCP connection. How can I make sure it use only one TCP connection instead of 20 or reuse the same connection. Snippets: request := gorequest.New() for i…
James Sapam
  • 16,036
  • 12
  • 50
  • 73
-1
votes
1 answer

How to share one HTTP request instance beween two goroutines?

I have some code that makes 3 requests to fill 3 variables now. Two requests are same. I want to share one http request between two different functions (in real world, these functions are splitted into two different modules). Let me describe the…
Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87
-2
votes
1 answer

gorequest package : check specifically for timeout

I am using the below package to make a outbound http request https://github.com/parnurzeal/gorequest For eg I am making a GET request like below res, body, errs = goReq.Get(url).End() My question is how to figure out if there is timeout in the…
user27111987
  • 995
  • 2
  • 10
  • 26