Skip to content

Update LocationInput struct to use omitempty for optional fields#29

Merged
donseba merged 2 commits intodonseba:mainfrom
filipemarques87:main
Mar 29, 2026
Merged

Update LocationInput struct to use omitempty for optional fields#29
donseba merged 2 commits intodonseba:mainfrom
filipemarques87:main

Conversation

@filipemarques87
Copy link
Copy Markdown
Contributor

@filipemarques87 filipemarques87 commented Mar 28, 2026

Do not serialize non required field in hx-location header

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the LocationInput JSON serialization so optional fields are omitted from the HX-Location header payload, matching the intent of not emitting non-required fields.

Changes:

  • Add omitempty JSON tags to optional fields on LocationInput.
  • Update TestNew to assert the expected minimal JSON payload for HX-Location.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
handler.go Marks optional LocationInput fields with omitempty so empty values aren’t serialized into HX-Location.
htmx_test.go Adds an assertion to verify the HX-Location JSON output omits empty optional fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread htmx_test.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@donseba donseba merged commit 6770245 into donseba:main Mar 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants