Skip to content

Commit

Permalink
Merge pull request #26 from strvcom/refactor/error-camel-case
Browse files Browse the repository at this point in the history
refactor: JSON tags in ErrorResponseOptions
  • Loading branch information
TomasKocman committed Jan 12, 2023
2 parents e78b5a6 + 578fd87 commit 0f6aa2e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ How to release a new version:

## [Unreleased]

## [0.4.0] - 2022-01-12
### Changed
- JSON tags in `ErrorResponseOptions`.

### Fixed
- JSON tag for `MaxHeaderBytes` field in `Limits` configuration.

## [0.3.0] - 2023-01-09
### Added
- HTTP response writer contains error field.
Expand All @@ -25,7 +32,8 @@ How to release a new version:
### Added
- Added Changelog.

[Unreleased]: https://github.com/strvcom/strv-backend-go-net/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/strvcom/strv-backend-go-net/releases/tag/v0.3.0
[0.2.0]: https://github.com/strvcom/strv-backend-go-net/releases/tag/v0.2.0
[Unreleased]: https://github.com/strvcom/strv-backend-go-net/compare/v0.4.0...HEAD
[0.4.0]: https://github.com/strvcom/strv-backend-go-net/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/strvcom/strv-backend-go-net/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/strvcom/strv-backend-go-net/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/strvcom/strv-backend-go-net/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion http/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Limits struct {

// MaxHeaderBytes is part of http.Server.
// See http.Server for more details.
MaxHeaderBytes int `json:"maxHeaderBytes"`
MaxHeaderBytes int `json:"max_header_bytes"`
}

// Timeouts represents configuration for HTTP server timeouts.
Expand Down
4 changes: 2 additions & 2 deletions http/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ type ErrorResponseOptions struct {
ResponseOptions `json:"-"`

Err error `json:"-"`
ErrCode string `json:"error_code"`
ErrData any `json:"error_data,omitempty"`
ErrCode string `json:"errorCode"`
ErrData any `json:"errorData,omitempty"`
}

type ErrorResponseOption func(*ErrorResponseOptions)
Expand Down

0 comments on commit 0f6aa2e

Please sign in to comment.