-
Notifications
You must be signed in to change notification settings - Fork 121
Add support for duplicate keys in parameters by adding paramValuesAsSeq
#323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add support for duplicate keys in parameters by adding paramValuesAsSeq
#323
Conversation
…l test requirements are present Only do this when nim version < 2.0
…re running the tests
…Seq` In contrast to `params` this returns a `Table[string, seq[string]]`. Closes dom96#247
This is also the same implementation used in `paramValuesAsSeq` (except for the return type), this way we ensure the same behaviour for the parsing/decoding steps.
Currently the server throws a 'SIGSEGV: Illegal storage access. (Attempt to read from nil?)'
Access url field
My mistake - I was sure, that there were a Failing CI on nim v2This is when |
CInim v2Alright, thanks for the info. I guess the addition of this CI version can be done at a later point then. WindowsRegarding the CI on windows, the exact error message is (nim: 1.6.14) I found the following issue in asynctools: cheatfate/asynctools#31 which seems to explain this. How do you want to proceed with this? Aside from these 2 issues, is there anything left which has to be addressed (additional reviews/changes/documentation/examples/...)? I guess at least the CI workflow still has to be approved and we need to test this on the mac pipeline (needs a decision on how the current windows bug should be handled). |
|
The For the I like the PR and your additional tests 👍. But, I'm just a contributor to the repo, so it must be @dom96 who can give you the directions for the next step. |
This reverts commit a4111d9.
|
Alright, thanks for your help. I've reverted the I'll wait for some input from dom then. |
|
Note about the Windows CI failures, I've fixed the I ran these on the current master to ensure that none of my changes has any impact on this. (I've ran mine as well and they're all The following test suites fail (I haven't looked into why this is):
Note that the I guess the impact from the Windows CI failing should be ignored in this case since it fails due to conditions which are already on master, this should probably be fixed separately. logs for
|
Closes #247
I've implemented an example solution (new function) so that we can discuss further based on this.
I've opened this as a PR since the actual implementation discussion is not really relevant for the issue itself.
I'm sorry to say that I'm still not entirely sure how the following would work:
I'm still fairly new to nim (<1000 lines) so forgive me if I'm missing something obvious here, the only options I see to implement this are
dotOperators)urlproperty (new type?) toRequestwhich supports this feature (this modifies code even further though and would be inconsistent with the current implementation)procto a different implementation when explicitely called by the user (or the library)httpbeastand the standard library and expose this via jester (also needs code changes since theNativeRequestisn't exposed to the user) (also unlikely to be accepted)That being said, this should probably be a separate function in any case which can be used by any of the other options if another shortcut/accessor is implemented for this.
I'm not entirely happy with the name (feel free to suggest others) but I hope it's at least clear enough on what it does.
I've removed the explicit call to
decodeUrl(value)(in bothparamsandparamValuesAsSeq) sincedecodeData(decodeQueryinternally) does the decoding for us already.parseUrlQueryI've also updated the
paramsfunction to not useparseUrlQueryanymore since this has been marked as deprecated in any case.With this change the 2 function operate essentially the same exact way (excluding the return type).
I haven't removed it since it's exported and might be used by users.
Tests
I've also implemented some tests for both
paramsandparamValuesAsSeq(exactly the same tests with different results).I tested this against the old version of
paramsand the new version.CI
os
Currently the CI:
versions
CI succeeds for nim 1.4.8 and 1.6.14, for nim 2 the CI throws a
SIGSEGV: Illegal storage access. (Attempt to read from nil?).I've observed this behaviour with jester before and either running nim with
--mm:refcor importingstd/segfaultsfixed this (which is very frustrating).I've only tested running with
--mm:refcwhich didn't fix it in the CI, I didn't want to importstd/segfaultsin all tests only for the CI to work since this is obviously a bug somewhere.I haven't looked into this any closer though, everything (tests + jester itself) run fine for me with nim 2.0 (locally and in docker).
Comments on things I've updated which aren't directly related to the issue. I hope including this here is fine with you, otherwise I don't mind pulling these changes out and opening a separate PR with them.
Exclude testing
tests/nim-in-action-codefornim >= 2.0nim-in-action-code isn't trying to be compatible with nim 2 (as far as I can tell).
The compilation currently fails because
db_sqliteisn't available anymore (needs animble install db_connectorand a change of import, i.e. ->db_connector/db_sqliteUpdate the CI
Basically this #319, I didn't want a broken CI when submitting a PR.
Update
nimble testUp to now the user had to execute some steps themselves (e.g. refresh/install),
nimble testshould now work without any further input from the user after cloning the repository..gitignore
I've developed with intellij so I've added the common ignores for this IDEhas been reverted (see #323 (comment))