Skip to content

Commit

Permalink
Update Kit version
Browse files Browse the repository at this point in the history
  • Loading branch information
neoxelox committed Apr 12, 2024
1 parent 5e4e76d commit 4f4cd12
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
11 changes: 8 additions & 3 deletions docs/api.col.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"client": "Thunder Client",
"collectionName": "Example",
"dateExported": "2024-01-29T01:04:50.004Z",
"dateExported": "2024-04-12T10:28:25.015Z",
"version": "1.1",
"folders": [],
"requests": [
Expand Down Expand Up @@ -128,8 +128,13 @@
"method": "POST",
"sortNum": 20000,
"created": "2024-01-20T19:37:47.071Z",
"modified": "2024-01-25T16:06:24.231Z",
"headers": [],
"modified": "2024-04-12T10:27:40.971Z",
"headers": [
{
"name": "Magic-Text",
"value": "Hello from the headers!"
}
],
"params": [],
"body": {
"type": "json",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/leporo/sqlf v1.4.0
github.com/mkideal/cli v0.2.7
github.com/neoxelox/errors v0.2.0
github.com/neoxelox/kit v0.29.0
github.com/neoxelox/kit v0.30.0
github.com/rs/xid v1.5.0
golang.org/x/text v0.14.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ github.com/neoxelox/errors v0.2.0 h1:AhvCMJAjUBFCP3PgZHbY6SS8Sc9fxx/DiawU5Cd5RxE
github.com/neoxelox/errors v0.2.0/go.mod h1:gCPnC7z8Qwswwz5Usv3WORxvan9Q6WSrDTvzaQyl7oM=
github.com/neoxelox/gilk v0.5.0 h1:Knw/TgSUnwPDIRJbqoTmG98gYsmKojNCJ5WAjALoWFc=
github.com/neoxelox/gilk v0.5.0/go.mod h1:Q+WgmSMKWd5UAaVjLSmGPbVD11AmHFhlo3QrPum0vo0=
github.com/neoxelox/kit v0.29.0 h1:DPifgqzkFvej7efogdqUZ9/a6j2dcq51CfwaY6L8K2k=
github.com/neoxelox/kit v0.29.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/neoxelox/kit v0.30.0 h1:Rpp/WKYZ/QDcPuFZrfyaA2aMYBzjJFoD3TNE0xjQbuw=
github.com/neoxelox/kit v0.30.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
13 changes: 9 additions & 4 deletions pkg/example/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ func (self *ExampleEndpoints) GetExampleByID(ctx echo.Context) error {
}

type ExampleEndpointsPostExampleRequest struct {
Name string `json:"name"`
Age int `json:"age"`
Role string `json:"role"`
WantsNewsletter *bool `json:"wants_newsletter"`
MagicText *string `header:"Magic-Text"`
Name string `json:"name"`
Age int `json:"age"`
Role string `json:"role"`
WantsNewsletter *bool `json:"wants_newsletter"`
}

type ExampleEndpointsPostExampleResponse struct {
Expand All @@ -93,6 +94,10 @@ func (self *ExampleEndpoints) PostExample(ctx echo.Context) error {
return kit.HTTPErrInvalidRequest.Cause(err)
}

if request.MagicText != nil {
self.observer.Info(ctx.Request().Context(), *request.MagicText)
}

// NOTE: Ideally this would be inside of an ExampleValidator
if !IsExampleRole(request.Role) {
return kit.HTTPErrInvalidRequest.Cause(ErrExampleEndpointsInvalidRole.Raise())
Expand Down

0 comments on commit 4f4cd12

Please sign in to comment.