Commit Graph

385 Commits

Author SHA1 Message Date
Adrien Marquès cc25995659 Merge pull request 'refactor/idiomatic-handlers-middlewares' (#25) from refactor/idiomatic-handlers-middlewares into 0.4.0
continuous-integration/drone/push Build is passing Details
Reviewed-on: #25
2021-06-20 08:26:27 +00:00
Adrien Marquès fd1ced5a8b
fix: restore request denied on invalid auth after contextual middlwares
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-06-20 10:24:12 +02:00
Adrien Marquès 97941da901
docs: update README for context.Context and middlewares
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-06-20 02:16:24 +02:00
Adrien Marquès af63c4514b
refactor: idiomatic remove of api.Context for context.Context, custom middlewares for standard http middlewares
continuous-integration/drone/push Build is passing Details
- remove api.Context as using context.Context is more idiomatic
 - remove api.Adapter as it is redundant with func(http.Handler) http.Handler
 - remove authentication middlewares as they be achieved as normal middlewares but launched around the handler (after the service has been found and validated)
 - builder.With() adds an standard Middleware that runs before any aicra code
 - builder.WithContext() adds an http middleware that runs just before the service handler is called. The http.Request provided contains a context with useful values such as the required permissions (from the service configuration).
 - handlers take a context.Context variable as first argument instead of api.Context
2021-06-20 02:14:31 +02:00
Adrien Marquès 6a78351a2c
doc: update README for *api.Context handler argument 2021-06-20 00:56:25 +02:00
Adrien Marquès 53dfc8f679
feat: *api.Context is required as first handler argument
continuous-integration/drone/push Build is passing Details
2021-06-20 00:47:04 +02:00
Adrien Marquès ed404106f2
refactor: rename api.Ctx to api.Context, extends context.Context with helper methods 2021-06-20 00:46:42 +02:00
Adrien Marquès fa1ecfd97f
feat: create internal context.Context custom keys 2021-06-20 00:46:04 +02:00
Adrien Marquès 418631e09d Merge branch 'feature/improve-readme' into 0.3.0
continuous-integration/drone/push Build is passing Details
2021-06-19 00:25:01 +02:00
Adrien Marquès 2d87052dda
fix: typos
continuous-integration/drone/push Build is passing Details
2021-06-19 00:24:26 +02:00
Adrien Marquès 610ab66ea8
readme: add logo, improve structure and explanations
continuous-integration/drone/push Build is passing Details
2021-06-19 00:17:37 +02:00
Adrien Marquès 3563d53365 Merge pull request 'feature: dynamic scope using input arguments' (#23) from feature/dynamic-scope into 0.3.0
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
Reviewed-on: #23
2021-05-19 12:06:19 +00:00
xdrm-brackets c35e2fdd9a
fix: do not use optional (nil) inputs for dynamic scope
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 17:45:07 +02:00
xdrm-brackets 8c2ebd916e
feat: add test coverage
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 16:30:20 +02:00
xdrm-brackets 2a17ba2f72
fix: allow non-Stringer using %v format (unsafe but does the job) 2021-05-18 16:24:31 +02:00
xdrm-brackets 346cc4e557
feat: add dynamic scope from request's input
- all occurences of '[abc]' where 'abc' is a valid input name ('name' field from json) is replaced with its value between square brackets
2021-05-18 16:06:49 +02:00
Adrien Marquès 214e2348aa Merge pull request 'feature: authentication middlewares' (#20) from feature/expose-scope into 0.3.0
continuous-integration/drone/push Build is passing Details
Reviewed-on: #20
2021-05-18 13:57:56 +00:00
Adrien Marquès 976b13bd38 Merge pull request 'fix: remove error status from json' (#22) from fix/json-err-status into 0.3.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #22
2021-05-18 09:10:53 +00:00
xdrm-brackets 3bb02fcbb7
fix: remove error status from json
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 11:10:12 +02:00
xdrm-brackets 4a62df8029
feat: handle auth adapters
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 09:59:49 +02:00
xdrm-brackets 4f55302e8a
feat: add WithAuth() to builder using api.AuthAdapter interface 2021-05-18 09:36:33 +02:00
xdrm-brackets 18d809c4ca
feat: create api.Auth wrapping authorization management 2021-05-18 09:34:01 +02:00
Adrien Marquès e3d24ae1ef Merge pull request 'feature: add optional context to handlers' (#19) from feature/context into 0.3.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
An optional first input argument of type api.Ctx to handlers to access standard request/response
2021-05-10 14:42:57 +00:00
Adrien Marquès af106acd3f refactor: test: dynamic function handler
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-04-19 23:34:31 +02:00
Adrien Marquès b88a4439c8 fixup: update comment for optional api.Ctx 2021-04-19 22:15:34 +02:00
Adrien Marquès e44dab4bc9 fixup: remove HasContext from spec 2021-04-19 19:55:00 +02:00
Adrien Marquès 1245861be7 test: builder
continuous-integration/drone/push Build is passing Details
2021-04-19 18:46:18 +02:00
Adrien Marquès d6f8457274 feat: pass optional context argument to handlers
continuous-integration/drone/push Build is passing Details
2021-04-18 19:31:54 +02:00
Adrien Marquès 939ab2e57d fixup: expose api context fields 2021-04-18 19:31:40 +02:00
Adrien Marquès 0a55c2ee13 feat: add optional api.Ctx first argument to handler checker 2021-04-18 19:25:31 +02:00
Adrien Marquès 24be7c294e test: dynamic func input 2021-04-18 18:26:37 +02:00
Adrien Marquès f334d19ef4 feat: add api context type 2021-04-18 18:14:30 +02:00
Adrien Marquès 08b825b38f Merge pull request 'feature: add http middleware capability' (#18) from feature/middleware into 0.3.0
continuous-integration/drone/push Build is passing Details
2021-04-18 16:08:10 +00:00
Adrien Marquès a693bbbf9b fix: reflect assign value to pointer of value in call argument
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-04-18 17:55:48 +02:00
Adrien Marquès 3986f7a022 fix: remove recoverer and body closer; must be users' responsability 2021-04-18 17:53:53 +02:00
Adrien Marquès 14ae59561c feat: encapsulate request handling into adapters 2021-04-18 16:50:02 +02:00
Adrien Marquès 96164127e1 feat: add Use() method to add adapters to the aicra builder 2021-04-18 16:49:46 +02:00
Adrien Marquès 87c15b91e5 feat: add middleware (Adapter) type 2021-04-18 16:49:24 +02:00
Adrien Marquès f3127edde1 Merge pull request 'improvements, fixes, update to go 1.16' (#16) from refactor/go1.16 into 0.3.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2021-03-28 17:44:58 +00:00
Adrien Marquès 546130cfd0
update: readme
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-03-28 19:41:25 +02:00
Adrien Marquès 11aa9f0a0f
fix: global handler recoverer 2021-03-28 19:05:43 +02:00
Adrien Marquès 468a09be8d
update: rename 'Server' into 'Handler' 2021-03-28 19:03:16 +02:00
Adrien Marquès 10e59acdae
fix: test string-int concatenation warnings 2021-03-28 18:50:25 +02:00
Adrien Marquès 334f1fba21
feat: add builder helpers Get(), Post(), Put(), Delete() that proxies to Bind() 2021-03-28 18:50:04 +02:00
Adrien Marquès 6039fbb41f
update: api.Err system
- rename 'Error' to 'Err'
 - use struct instead of int as underlying type ; remove dependency on 2 maps for reason and HTTP status codes
 - remove useless json implementation
2021-03-28 18:49:23 +02:00
Adrien Marquès a9acfca089
update go.mod to go 1.16 2021-03-28 18:06:09 +02:00
Adrien Marquès fb69dbb903 Merge branch 'refactor-test' of go/aicra into 0.3.0
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2020-04-04 15:33:43 +00:00
Adrien Marquès 658c66d2db
update readme
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-04-04 17:33:08 +02:00
Adrien Marquès 3c453e7f89
remove api useless request, update default errors and bind status codes to errors
continuous-integration/drone/push Build is passing Details
2020-04-04 16:03:50 +02:00
Adrien Marquès d198086dd4
fix http error handlers 2020-04-04 16:03:12 +02:00