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.

121 questions
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,827
  • 10
  • 47
  • 92
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_
  • 1,364
  • 14
  • 24
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,263
  • 7
  • 52
  • 86
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
  • 27
  • 1
  • 11
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,171
  • 4
  • 16
  • 28
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
  • 47
  • 2
  • 5
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
  • 467
  • 10
  • 22
0
votes
2 answers

goroutine different behaviour for statement execution and function execution

Can anyone explain the difference between the following two calls regarding the goroutines? Method 1 fmt.Println("Starting srv") go LOGGER.Error(srv.ListenAndServe()) fmt.Println("Starting intSrv") go LOGGER.Error(intSrv.ListenAndServe()) This…
Mayuran
  • 669
  • 2
  • 8
  • 39
0
votes
1 answer

Displaying a pagination widget in Go

I am using HTML templating in Go to render a pagination widget. I am trying to follow an example of how to do it from here: https://www.solodev.com/blog/web-design/adding-pagination-to-your-website.stml This is my code so far: // Item size like call…
Lookas
  • 3
  • 5
0
votes
2 answers

How to unmarshal with different types of the same variable

Im working with the API with possibile output: [ { "contactId": 2, "email": "karina.plain@example.com", "markerName": "JavascriptEngine", "dataType": "String", "value": "Carakan", "dateEntered": "2013-01-03T14:52:00" }, { …
R.Slaby
  • 349
  • 2
  • 4
  • 10
0
votes
0 answers

How to create a generic request validation middleware

What I want to achieve here is to create a very generic middleware called, Expects that actually validates the current request according to the parameters provided. It will raise a Bad Request if the required params are not present or are empty. In…
Ahmed Dhanani
  • 841
  • 1
  • 11
  • 32
0
votes
1 answer

Post Request with PostgreSQL and json-api returns an empty body

After a POST request, i was expecting to have a last inserted record marshalled into json, but instead returns an empty body. What am i not doing well? package models import ( "encoding/json" "errors" "flag" "fmt" "log" …
afidegnum
  • 161
  • 4
  • 21
0
votes
2 answers

"http.FileServer(http.Dir...))" not working in separate package

Directory tree: . ├── main.go └── web ├── app.go └── views ├── index.html └── js └── app.jsx This works: package main import ( "net/http" ) func main() { http.Handle("/",…
sean
  • 3,484
  • 5
  • 27
  • 45
1 2 3
8 9