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
f2423bd71a
make internal/multipart use internal/cerr constant errors
...
- instead of defining its own
2020-03-08 16:26:55 +01:00
Adrien Marquès
638f5e44c8
test internal/config trick to have a 100% coverage (as conflict check is undeterministic, merge all conditions)
2020-03-08 16:26:55 +01:00
Adrien Marquès
228f5b9a02
test internal/config empty parameter rename should not rename
2020-03-08 16:26:55 +01:00
Adrien Marquès
aba95d4163
remove dead code
2020-03-08 16:26:55 +01:00
Adrien Marquès
e9c7160d2e
expand internal/config test coverage
...
- make parameter type "?" invalid as it marks it as optional only
- check optional vs. required parameters
- test subservice in method description error check
2020-03-08 16:26:55 +01:00
Adrien Marquès
61b58a9f98
add internal/config test for the Browse() method
2020-03-08 16:26:55 +01:00
Adrien Marquès
dd0e321cbd
test internal/config parsing and illegal/missing fields
2020-03-08 16:26:55 +01:00
Adrien Marquès
5ac3b81f6d
parameter name conflict: on rename conflicting rename, return original name
2020-03-08 16:26:55 +01:00
Adrien Marquès
4accad7286
refactor internal/config
...
- create cerr (constant errors) with wrapped context (service name, method, parameter name)
- fix comments numbering
- remove duplicate check
2020-03-08 16:26:55 +01:00
Adrien Marquès
dec7fd9a62
test internal/cerr package + add WrapString() to use a raw string
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
be84c86172
fix: use t.Run in tests instead of for{} with i
2019-05-05 19:01:54 +02:00
Adrien Marquès
21f48a65ee
feat: parallelize tests +ci
2019-05-05 19:01:54 +02:00
Adrien Marquès
bf3e651c2c
ref: clean comments and make errors constants
2019-05-05 19:01:54 +02:00
Adrien Marquès
eb5ce4c0d0
fix: semantic renaming : internal.config.Method.Permission is now Scope
2019-05-05 19:01:54 +02: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
0e498607ba
clean
2019-05-05 19:01:54 +02:00
Adrien Marquès
b9f240b86b
feat: fix error creation to bind arguments directly + add optional error argument in NewResponse()
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
Adrien Marquès
16d3399ee9
ref 0: internal.checker renamed typecheck (no more internal)
2019-05-01 11:28:55 +02:00
Adrien Marquès
8d45d3241b
ref 0: internal.checker defines an interface ; default types are in internal.checker.builtin
2019-05-01 11:23:05 +02:00
Adrien Marquès
8109f57d15
ref 0: internal.apidef becomes internal.config + refactoe
2019-05-01 10:29:23 +02:00
Adrien Marquès
a63e227538
ref 0: internal/request
2019-05-01 00:02:28 +02:00
Adrien Marquès
0eee615aea
rename 'internal/api' to 'internal/apidef' (api definition)
2018-10-07 11:40:35 +02:00
Adrien Marquès
5e7ece3f30
fix mispelled words
2018-10-07 11:14:54 +02:00
Adrien Marquès
d590d31327
add exported fields' comments
2018-10-07 11:14:04 +02:00
Adrien Marquès
fe3034818d
add 'id' (positive 'int') type checker
2018-10-02 12:00:57 +02:00
Adrien Marquès
93aa8b66dc
add 'bool' type checker
2018-10-02 11:59:12 +02:00
Adrien Marquès
12ddf1feae
add 'float' type checker
2018-10-02 11:55:47 +02:00
Adrien Marquès
e43623d108
default type check 'string' does not use 'reflect' no more
2018-10-02 11:50:01 +02:00
Adrien Marquès
50de7a4297
default type check 'int' does not use 'reflect' anymore
2018-10-02 11:46:22 +02:00
Adrien Marquès
f9a928c181
add 'digest(length)' type checker + minfix import in cmd/main
2018-10-02 11:34:58 +02:00
Adrien Marquès
b1092437f9
refactor default type checkers | load default types if set in aicra.json (.build/DEFAULT_TYPES/*.so)
2018-10-02 11:10:21 +02:00
Adrien Marquès
d406338777
implement driver for type checkers | move controller/middleware/checker definition inside the 'driver' package (all uses are exported from this place) | now driver.Driver returns 'Controller', 'Middleware', and 'Checker' in the interface | a lot a junk
2018-10-01 19:27:38 +02:00
Adrien Marquès
37fe30ebc7
rename 'internal/meta' to 'internal/config' | move driver type definition into explicit file + remove 'import' driver | remove useless method to parse multipart
2018-10-01 17:43:18 +02:00
Adrien Marquès
7bcbefdf35
rename 'internal/config' to 'internal/api' | rename 'internal.api.Load()' to 'internal.api.Parse()'
2018-10-01 14:15:00 +02:00
Adrien Marquès
fd6d7b661e
add implementation to 'default types'
2018-10-01 14:02:09 +02:00
Adrien Marquès
b6e19c255b
implement 'AICRA' command | system to parse config, set defaults, infer map of sources from a folder, etc
2018-10-01 12:29:05 +02:00
Adrien Marquès
9c9079f06b
add 'driver.Driver.Name() string' and use it to select the default type/middleware folder (.build/middleware or middleware) | fix driver.Generic.LoadMiddleware() | remove variadic arguments for middleware.CreateRegistry() and checker.CreateRegistry()
2018-09-28 15:59:21 +02:00
Adrien Marquès
2cfc5a2ba0
update 'middleware' types | rename driver.Driver.Load() into RunController() | add driver.Driver.LoadMiddleware() | add driver management to middleware.Registry at creation | [TODO] implement diver.Generic.LoadMiddleware()
2018-09-28 10:54:13 +02:00
Adrien Marquès
74e4ce83cb
restrict parameter names in config + ignore parameter names in received requests
2018-09-28 08:54:04 +02:00
Adrien Marquès
f5800900b0
rename 'internal/apirequest' to 'internal/request' but use import alias 'apirequest' in dependencies
2018-09-28 08:10:41 +02:00
Adrien Marquès
fced676c42
add 'driver/generic' (to test, alpha version)
2018-09-27 14:11:48 +02:00
Adrien Marquès
3feae783dc
add driver management + moved implementation of default driver into 'driver/plugin'
2018-09-27 13:43:36 +02:00
Adrien Marquès
8c02bc53a5
add \r\n management instead of just \n + test the new behaviour
2018-09-26 09:36:41 +02:00
Adrien Marquès
ff9ff23e5a
fix \r\n trim for multipart lines
2018-09-26 08:09:55 +02:00
Adrien Marquès
0974658bf2
add debug to debug body parsers
2018-09-26 07:35:53 +02:00
Adrien Marquès
592ed23638
update multipart parser + tests
2018-09-25 21:22:25 +02:00
Adrien Marquès
f76e3d35fa
update readme + comment
2018-09-13 10:21:35 +02:00
Adrien Marquès
5aef3f5572
server implements http.Handler (ServeHTTP(responseWrite, request)) | apirequest.BuildFromHTTPRequest() becomes apirequest.FromHTTP() | update readme
2018-07-11 19:02:33 +02:00
Adrien Marquès
05d5c23038
fix aicra.files.IsDir() which logic was inverted | make add() private for registries (checker + middleware) + fix server.go (invalid address for Server.controller because wasn't initialized to NIL)
2018-07-11 01:51:10 +02:00
Adrien Marquès
1aee9e92fd
rename package 'request' -> 'apirequest' ; 'config' -> 'controller' + main types.go bundled into server.go + made attributes non-exported (lowercase)
2018-07-11 01:36:42 +02:00
Adrien Marquès
61b3c6c91c
min rename
2018-07-09 01:37:57 +02:00
Adrien Marquès
637bc91770
LINT: renaming + refactor
2018-07-09 01:34:21 +02:00
Adrien Marquès
6ebdd61325
LINT + Server.extractParameters is now private + add management for errors : 'UncallableController' and 'UncallableMethod'
2018-07-09 01:00:45 +02:00
Adrien Marquès
07bbdbbe30
rename 'implement' into 'response'
2018-07-09 00:15:29 +02:00
Adrien Marquès
6784c2df95
moved local imports into 'internal' parent package
2018-07-09 00:10:03 +02:00
Adrien Marquès
2b1bf77c0f
removed from /internal directory
2018-05-30 09:02:08 +02:00
Adrien Marquès
8f9c86c391
moved data parser into 'request_data' + created internal lib to parse multipart inside 'internal/multipart' + added default type 'any' + more things...
2018-05-29 15:43:09 +02:00
Adrien Marquès
73c36a3821
config.Load() now sets defaults for optional fields
2018-05-24 16:53:39 +02:00
Adrien Marquès
75db1513bb
add Controller.Method(string) to interface the extraction of dynamic method
2018-05-24 16:22:29 +02:00
Adrien Marquès
8106c22dbd
implemented method check in 'config' package
2018-05-24 16:18:28 +02:00
Adrien Marquès
32520a1591
full parameter gathering in 'request_builder'
2018-05-22 09:10:10 +02:00
Adrien Marquès
18f4bcbbae
add 'controller path-finding' + 'method check' + [TODO: issue with ParseMultipartForm() that is slow]
2018-05-21 13:02:15 +02:00
Adrien Marquès
60c0c92f3a
add config.format(name string) to format/check config format
2018-05-20 12:21:27 +02:00
Adrien Marquès
c9326a1bb3
moved 'config' in /internal
2018-05-20 10:46:39 +02:00