lars v3.3.1 Release Notes

Release Date: 2016-08-24 // over 7 years ago
  • 🛠 What was fixed?

    ↪ Nothing in lars was fixed, just a workaround provided to save everyone that is using an external library that stored the http.Request as a map key.

    eg. nosurf, gorilla context ..........

    boy once people start using the built in context object on the http.Request they are going to find some fun quirks, because of the way context is tied to the http.Request libraries like nosurf that store the http.Request in a map key, but as soon you store a value the http.Request changes and then the http.Request cannot be found in the map anymore in another middleware after that.

    ↪ I can just imagine the number of applications that could break because of this.... anyway the temporary workaround will save you, but if you're using
    a non lars.Context handler be sure to shallow copy the request to avoid this issue.

    // because 'r' is a copy of a pointer to allow the information to get// back to the caller, need to set the value of 'r' as below with '\*r'func(w http.ResponseWriter, r \*http.Request) { \*r = \*r.WithContext(context.WithValue(r.Context(), 0, "testval1")) }