0

So, the problem I'm having is that in some cases my application needs a more complex search and filtering, and because of that, the requests need some parameters. In sometimes is necessary to pass an array with many entries which can cause the overflow of the URI query parameter limitation.

Since HTTP Get requests shouldn't have an HTTP body, the easiest solution to solve this was to change the request method to Post. But I find this a problem and was expecting that someone could show me better solutions to this problem that I was just too inexperienced to see.

From this

HTTP Get /resource?array=[''...] //could reach the maxlenght of the query parameters

to this

HTTP Post /resource/search
body: {
  'array': ['' ...]
}

1 Answer 1

1

Since HTTP Get requests shouldn't have an HTTP body, the easiest solution to solve this was to change the request method to Post. But I find this a problem and was expecting that someone could show me better solutions to this problem that I was just too inexperienced to see.

As of 2020-12-30, there isn't a best solution.

Your choices are

  • GET, and run into the defacto limits on target-uri length
  • POST, and lose both caching and the benefits of safe semantics
  • YOUR_BEPOKE_METHOD_TOKEN_HERE, and lose generality (general purpose components won't know the semantics of your bespoke method)
  • NEW_STANDARDIZED_METHOD_TOKEN, which requires going through the standardization process and then driving adoption.

The good news, is that as of 2020-10, the HTTP working group has adopted a proposal to address this (in other words, other people are working on the NEW_STANDARDIZED_METHOD_TOKEN approach).

My guess is that the working group will eventually produce a specification that relaxes the restrictions on the existing SEARCH method, so that it can be used for payloads beyond those defined in the WebDAV specification.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.