Skip to content

Support reading params in content body for HTTP methods other than POST #215

Closed
ngocdaothanh opened this Issue Nov 4, 2013 · 3 comments

3 participants

@ngocdaothanh

Currently, PUT, PATCH, and DELETE are not supported:

https://github.com/twitter/finagle/blob/master/finagle-http/src/main/scala/com/twitter/finagle/http/ParamMap.scala#L173

if (request.method == Method.Post &&
    request.mediaType == Some(MediaType.WwwForm) &&
    request.length > 0) {
  parseParams("?" + request.contentString)
} else {
  ParamMap.EmptyJMap
}
@jeffreyolchovy jeffreyolchovy added a commit to jeffreyolchovy/finagle that referenced this issue Feb 6, 2014
@jeffreyolchovy jeffreyolchovy support reading params in content body for HTTP methods other than PO…
…ST and PUT

closes #215
1d0cd4e
@jeffreyolchovy

This routine was updated four months ago to also allow param parsing during PUT operations (0e81b67), however, it may be useful to allow parsing and retrieval of params during any arbitrary HTTP method unless that method is explicitly forbidden from containing an entity-body by the HTTP spec. I believe TRACE is the only method that explicitly forbids an entity-body [1, 2]; but parsing the params on, say, a GET request, is, in my opinion, questionable. However, I'd leave it up to the library user to decide whether on not they want their server to access the entity-body regardless of the type of request.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8
[2] An interesting discussion regarding whether or not the DELETE method should contain an entity-body http://stackoverflow.com/a/299696

@mosesn
mosesn commented Feb 28, 2014

Hey @jeffreyolchovy, sorry we're only getting to this now, I don't really have the expertise to handle this, I'm going to find someone who knows more about http to take a look at this.

@jeffreyolchovy jeffreyolchovy added a commit that referenced this issue Mar 25, 2014
@jeffreyolchovy jeffreyolchovy [split] support reading params in content body for HTTP methods other…
… than POST and PUT closes #215

Signed-off-by: Moses Nakamura <mnakamura@twitter.com>

RB_ID=298681
34e2a24
@mosesn
mosesn commented Feb 4, 2015

I think @jeffreyolchovy's patch fixes this, closing this for now. Please reopen if there are still issues.

@mosesn mosesn closed this Feb 4, 2015
@suncelesta suncelesta added a commit to suncelesta/finagle that referenced this issue Feb 19, 2015
@jeffreyolchovy jeffreyolchovy [split] support reading params in content body for HTTP methods other…
… than POST and PUT closes #215

Signed-off-by: Moses Nakamura <mnakamura@twitter.com>

RB_ID=298681
3b821a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.