Skip to content

Tags: sv-tools/mock-http-server

Tags

v1.4.0

Toggle v1.4.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(tests,config): add tests, response delay, and logging fixes (#105) Add comprehensive for configuration parsing and port precedence. New main_test.go covers missing config file handling, invalid PORT env values, using env port when no flag is provided, flag overriding env, config+flag precedence, and decoding unknown fields. Helpers are added to write temporary config files. Introduce a Delay field on Response (time.Duration) and apply the delay when writing responses. Extract JSON content type into a constant (JsonContentType) and use it when setting the header. Simplify responsesWriter by removing the logger parameter and use slog.Error for error reporting when writing response bodies. Misc: update test logger helper signature to accept testing.TB and adjust imports to include time. These changes enable testing of port/config behavior and add configurable response delays.

v1.3.0

Toggle v1.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
test: add unit tests for responses writer, templ, logger (#104) * test: add unit tests for responses writer, templ, logger Add comprehensive tests for the HTTP response writer, template execution, and structured logging middleware. Key changes: - Add TestResponsesWriter_FileAndJSONHeader to verify serving file contents, status code, JSON content-type, and custom headers. - Add TestResponsesWriter_RepeatLogic to assert Repeat behavior keeps a response for N calls before advancing to the next response. - Add TestResponsesWriter_NotFoundWhenExhausted to ensure a 404 is returned when no responses remain. - Add TestResponsesWriter_FileReadError to check 500 on missing file and that the error message includes the filename. - Add TestResponsesWriter_JSONDoesNotOverrideExistingContentType to confirm IsJSON does not overwrite an explicitly set Content-Type. - Add TestExecuteTemplate_Success and TestExecuteTemplate_ParseError to validate template execution and parse error handling. - Add TestStructuredLogger_BasicFields and helpers to validate JSON structured logging output and basic middleware behavior. Also add testLogger helper for building a JSON logger writing to a buffer. Tests use httptest, temporary files, and explicit header assertions to make behavior deterministic. Update responses_writer_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update responses_writer_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update responses_writer_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

v1.2.2

Toggle v1.2.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
ci: update release workflow and Goreleaser config (#90) Replace manual Docker setup with docker/setup-buildx-action to enable multi-platform builds in the release workflow. Remove deprecated DOCKER_CLI_EXPERIMENTAL environment variable. Fix Goreleaser config file reference and update its format to version 2 with corrected archive formats. These changes improve build reliability and maintainability.

v1.2.1

Toggle v1.2.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
ci: enhance GitHub Actions with JUnit test reporting (#88) Add installation of go-junit-report to generate JUnit XML test reports from Go test output. Upload these test results alongside coverage data to Codecov for improved test reporting and analysis. Ensure uploads run only if the workflow is not cancelled. This improves CI visibility and debugging.

v1.2.0

Toggle v1.2.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
docs: improve README with docker usage instructions (#85) Add detailed steps to run the mock-http-server using the latest docker image or by building and running the image locally. Include example commands for both approaches to simplify usage. Also add example logs produced by the server to demonstrate expected output and help users verify correct operation. These changes improve the clarity and usability of the README for new users.

v1.1.0

Toggle v1.1.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Bump golangci/golangci-lint-action from 6.3.1 to 6.5.0 (#67) * Bump golangci/golangci-lint-action from 6.3.1 to 6.5.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.3.1 to 6.5.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@2e78893...2226d7c) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix CI and use Go v1.24 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergey Vilgelm <sergey@vilgelm.com>

v1.0.0

Toggle v1.0.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix Codecov upload action (#50) 

v0.5.0

Toggle v0.5.0's commit message

Verified

This commit was signed with the committer’s verified signature.
SVilgelm Sergey Vilgelm
update README and fix release workflow (#42) 

v0.4.0

Toggle v0.4.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Bump github.com/go-chi/chi/v5 from 5.0.12 to 5.1.0 (#39) Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.12 to 5.1.0. - [Release notes](https://github.com/go-chi/chi/releases) - [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md) - [Commits](go-chi/chi@v5.0.12...v5.1.0) --- updated-dependencies: - dependency-name: github.com/go-chi/chi/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v0.3.0

Toggle v0.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Bump github.com/go-chi/chi/v5 from 5.0.11 to 5.0.12 (#22) * Bump github.com/go-chi/chi/v5 from 5.0.11 to 5.0.12 Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.11 to 5.0.12. - [Release notes](https://github.com/go-chi/chi/releases) - [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md) - [Commits](go-chi/chi@v5.0.11...v5.0.12) --- updated-dependencies: - dependency-name: github.com/go-chi/chi/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix linting issue --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergey Vilgelm <sergey@vilgelm.com>