Adrien Marquès
1cc24be254
feat: url encoded parameters (uri + form) are only considered a slice when multiple values are set
...
- if `?a=123`, "123" is the value that can be validated as string, int, etc
- if `?a=123&a=456`, the slice []type{123,456} is the value that can be validated as slice of strings, ints, etc.
2021-06-22 23:44:21 +02:00
Adrien Marquès
822ef823e9
migrate: symbols import paths to github
2021-06-20 21:29:46 +02:00
Adrien Marquès
10e59acdae
fix: test string-int concatenation warnings
2021-03-28 18:50:25 +02:00
Adrien Marquès
990bb86919
rework reqdata api and remove redundant comments
2020-04-04 14:56:15 +02:00
Adrien Marquès
5cc3d2d455
use http.Request instead of pointer
2020-04-04 12:03:29 +02:00
Adrien Marquès
9a5b0dd6e3
remove Parameter type, only keep method parseParameter()
2020-03-21 14:45:39 +01:00
Adrien Marquès
149ec9a9a0
internal/reqdata Parse() does not return errors anymore
2020-03-21 14:20:26 +01:00
Adrien Marquès
9475fe4526
use private errors do avoid overlapping types among packages
2020-03-21 14:19:14 +01:00
Adrien Marquès
3606f9984d
update tests for internal/reqdata set
continuous-integration/drone/push Build is failing
Details
2020-03-20 22:36:15 +01:00
Adrien Marquès
7b812c6648
get data from multipart components
2020-03-20 22:35:53 +01:00
Adrien Marquès
dc34d9a81a
wrap multipart errors in dedicated error : ErrInvalidMultipart
2020-03-20 22:35:30 +01:00
Adrien Marquès
cdbe4cceac
ignore io.EOF while parsing multipart
2020-03-20 22:27:01 +01:00
Adrien Marquès
03d5e87c37
wrap json parser into dedicated error : ErrInvalidJSON
2020-03-20 22:26:43 +01:00
Adrien Marquès
c7aa87c660
ignore EOF when parsing form as json
2020-03-20 22:18:34 +01:00
Adrien Marquès
0f62fc25a0
use request.URL.RequestURI() insteaf of request.RequestURI() ; it is not the same
2020-03-20 22:09:38 +01:00
Adrien Marquès
b38a9a8111
refactor internal/reqdata to work with thew new config
2020-03-16 12:50:30 +01:00
Adrien Marquès
682e20a959
test primitive types : bool, float64
2020-03-08 16:26:56 +01:00
Adrien Marquès
ec152aec4b
fix parsing primitive types instead of erroring unknown type
2020-03-08 16:26:56 +01:00
Adrien Marquès
ccf6577bc5
test bool slice vs. json bool slice
2020-03-08 16:26:56 +01:00
Adrien Marquès
5dad0ecc39
test string slice vs. json string slice
2020-03-08 16:26:56 +01:00
Adrien Marquès
4cb62ea122
fix parsing non-string slice values
...
- only string were parsed using wrapped json
- now we also keep primitive types
2020-03-08 16:26:56 +01:00
Adrien Marquès
313b91bb7f
remove outdated tests
2020-03-08 16:26:56 +01:00
Adrien Marquès
5741ec597b
[breaking] do not return first element of 1-sized slices as it, return a slice
...
- it is more consistent and does not rely of a "hidden" assomption.
- for consistency, it is also a better practice to always the same type when waiting to receive a slice ; the 1 element case should not break anything
2020-03-08 16:26:56 +01:00
Adrien Marquès
7e7eb3ac29
fix returning first element of 1-sized slice instead of the slice
2020-03-08 16:26:56 +01:00
Adrien Marquès
e132a5af42
test conversion from 1-sized slice to first element (bool vs json boolean primitive)
2020-03-08 16:26:56 +01:00
Adrien Marquès
41d166529c
test json invalid float primitives ; only valid when wrapped
2020-03-08 16:26:56 +01:00
Adrien Marquès
45675713e7
fix formatting type
2020-03-08 16:26:56 +01:00
Adrien Marquès
0395d763d6
test json invalid boolean primitives ; only valid when wrapped
2020-03-08 16:26:56 +01:00
Adrien Marquès
4d663fc56c
test string slice as string ; invalid json but valid when wrapped
2020-03-08 16:26:56 +01:00
Adrien Marquès
98878eb127
test simple string parameter
2020-03-08 16:26:55 +01:00
Adrien Marquès
fab09b2a5b
fix: mark parameter as parsed after successful parsing
...
- avoid parsing multiple times in a row ; it has no side-effect but is useless
- actually does not cause any issue, but for consistency sake!
2020-03-08 16:26:55 +01:00
Adrien Marquès
b890fa0ccc
return error when parsing parameters
2020-03-08 16:26:55 +01:00
Adrien Marquès
edc49d9915
expand store.go coverage to 100% with a tricky test
...
- force http.Request.ParseForm to fail
2020-03-08 16:26:55 +01:00
Adrien Marquès
f076f3a88a
replace bytes.NewBufferString() with strings.NewReader()
2020-03-08 16:26:55 +01:00
Adrien Marquès
727737ae67
test multipart body paramters
2020-03-08 16:26:55 +01:00
Adrien Marquès
d1d581bd75
Test json: add a check with invalid json (no parameter is parsed)
2020-03-08 16:26:55 +01:00
Adrien Marquès
5f1d76a0a8
Test json body parameters
2020-03-08 16:26:55 +01:00
Adrien Marquès
ac7adcbd1f
Test with url encoded body parameters
2020-03-08 16:26:55 +01:00
Adrien Marquès
5897461323
Test store agains Query parameters
2020-03-08 16:26:55 +01:00
Adrien Marquès
44d19e8b65
Test store with uri arguments
2020-03-08 16:26:55 +01:00
Adrien Marquès
613233faef
Test empty store -> fix
2020-03-08 16:26:55 +01:00
Adrien Marquès
c40fb03aa7
merge parseParameter
2020-03-08 16:26:55 +01:00
Adrien Marquès
189d3b40a6
fix: semantic (comments) renaming : 'controller' to 'service', more explicit names
2019-05-05 19:01:54 +02:00
Adrien Marquès
cd2bcdd8bc
ref 0: first working version ; totest
2019-05-01 15:14:49 +02:00
Adrien Marquès
7e66b6ddd5
ref 0: big refactor of concerns between api request, server, etc
2019-05-01 13:44:45 +02:00