Go web server is automatically redirecting POST requests
<p>I've been trying to solve a <a href="https://stackoverflow.com/questions/36295758/http-post-method-is-actally-sending-a-get">weird problem</a> for quite some time now. After stepping through lots of angular code, I noticed something weird while logging requests to my server through Charles.</p>

<p>When I post to a url <code>/myurl</code> the request never actually hits my server. Instead, it gets a 301 response and THEN a GET request hite my server. </p>

<p>This is incredibly puzzling. Has anyone else run into this problem? I've uploaded a screenshot of my Charles log incase you are interested.</p>

<p><a href="https://i.stack.imgur.com/sCQy2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sCQy2.png" alt="enter image description here"></a></p>

<p>Just as a reference, this is what my server looks like:</p>

<pre><code>type FormStruct struct {
    Test string
}

func PHandler(w http.ResponseWriter, r *http.Request) {
    var t FormStruct

    req, _ := httputil.DumpRequest(r, true)

    log.Println(string(req))
    log.Println(r.Method) // GET
    log.Println(r.Body)

    decoder := json.NewDecoder(r.Body)
    err := decoder.Decode(&amp;t)
    log.Println("Decoding complete")
    if err != nil {
        log.Println("Error")
        panic(err.Error()+"\n\n")
    }
    log.Println(t.Test)

    w.Write([]byte("Upload complete, no errors"))
}

func main() {
    http.HandleFunc("/myurl/", PHandler)    
    fmt.Println("Go Server listening on port 8001")
    http.ListenAndServe(":8001", nil)
}
</code></pre>