Skip to content

Releases

v1.7.0 — status helpers

Choose a tag to compare

@acoshift acoshift released this 25 Nov 08:37
7c62ed3

Named status helpers, and error responses that callers can propagate.

Status helpers

BadRequest, Unauthorized, Forbidden, Conflict, UnprocessableEntity, TooManyRequests, InternalServerError, and ServiceUnavailable write the status and a message, then return ErrResponseWritten. An empty message uses the status text.

return ctx.Forbidden("nope")

NotFound is unchanged (404 page not found). Other codes stay on ctx.Status(code).Error(message).

Behavior change

Context.Error and Context.NotFound now return ErrResponseWritten after writing the body. Handler treats that error as already handled, including when wrapped, so return ctx.Error(...) still completes the request. A helper that returns it is non-nil, so if err != nil { return err } stops before a second write.

Callers that treated a nil return from Error or NotFound as success and then wrote their own body must propagate the error instead.

Tooling

  • Requires Go 1.26. Direct modules updated: parapet v0.19.2, testify v1.12.1, minify v2.25.0.
  • Repo guidance lives in AGENTS.md.

Full changelog: v1.6.0...v1.7.0 (#125, #126)

v1.6.0 — htmx SPA integration

Choose a tag to compare

@acoshift acoshift released this 19 Jul 13:44
efadca2

Server-rendered apps that feel like a SPA with htmx — one template set, no client build step. See the htmx guide.

Fragment rendering

  • ctx.View("page#form", data) renders a single {{block}}/{{define}} of a view through the same minify/ETag pipeline as full pages.
  • ctx.ViewPartial(name, fragment, data) — fragment for htmx partial requests, full page for everyone else (deep links, back button, JS-off).
  • Breaking (parse time only): # is now reserved — registering a template or component name containing it panics at parse time.

htmx helpers

  • Predicates ctx.IsBoosted() and ctx.WantsPartial() (pure header reads; IsHTMX() unchanged).
  • app.HTMXAwareRedirect (opt-in): the whole Redirect family answers partial htmx requests with HX-Redirect + 204 instead of a 3xx, so post/redirect/get + flash flows work unchanged over htmx.
  • New chainable helpers: HTMXPushURL, HTMXReplaceURL, HTMXNoPush, HTMXReselect, HTMXLocation, HTMXTriggerAfterSwap, HTMXTriggerAfterSettle.
  • Behavior change: repeated HTMXTrigger calls now merge into one header instead of clobbering (merged events serialize in alphabetical order).

Caching

  • ctx.NoCache() — chainable Cache-Control: no-store.
  • ctx.VaryHTMX() — chainable Vary: HX-Request, HX-Boosted, HX-History-Restore-Request for cacheable responses that branch on htmx headers. Nothing sets Vary automatically; call it when you need it.

Docs

  • README htmx section: partial rendering, out-of-band swap pattern, active-nav recipe, 422 validation config, caching guidance.
  • Modernized CSRF guidance: explicit SameSite cookies + Go 1.25's http.NewCrossOriginProtection instead of token middleware (#124).

Full changelog: v1.5.0...v1.6.0 (#123, #124)

v1.5.0

Choose a tag to compare

@acoshift acoshift released this 10 Jun 01:47
4a68b90

Highlights

A productivity release for server-rendered MPA / htmx sites — the output of a feature-DX review. Every addition is a thin, no-lock-in helper over the standard library; all changes are additive (no breaking changes, still Go 1.25).

htmx (#119)

ctx.IsHTMX(), HTMXRedirect, HTMXRefresh, and chainable HTMXReswap / HTMXRetarget / HTMXTrigger — detect htmx requests and drive swaps/redirects from Go.

Templates & components (#118)

  • dict template func — pass multiple values to a component/partial: {{component "card" (dict "title" .T "body" .B)}}.
  • json template func — inline <script> state, escaped for <script> safety.
  • ctx.RenderComponentToString — render a component to a string for out-of-band composition.

Forms & navigation

  • ctx.FormState() (#121) — re-render a form with the submitted values and per-field validation errors.
  • ctx.IsRoute(name) (#122) — most-specific active-nav highlighting; use from templates as {{.IsRoute "home"}} by passing ctx as the view data.
  • Stateless flash messages AddFlash / Flashes (#120) — post/redirect/get with no session store.

Security

  • Opt-in signed cookies (#117) — a CookieSigner interface plus an HMAC-SHA256 reference impl (NewHMACCookieSigner), wired through AddSignedCookie / SignedCookieValue. Binds the cookie name into the MAC, verifies in constant time.

What's Changed

  • feat: add opt-in signed cookies (CookieSigner + HMAC-SHA256) by @acoshift in #117
  • feat: add dict/json template funcs and RenderComponentToString by @acoshift in #118
  • feat: add htmx Context helpers by @acoshift in #119
  • feat: add stateless flash messages by @acoshift in #120
  • feat: add FormState for re-rendering forms after validation by @acoshift in #121
  • feat: add ctx.IsRoute for active-nav highlighting by @acoshift in #122

Full Changelog: v1.4.0...v1.5.0

v1.4.0

Choose a tag to compare

@acoshift acoshift released this 09 Jun 13:12
ec7ec54

Highlights

New Context helpers (#115)

  • XML(data) and BindXML(v) — XML response and request-body binding, mirroring JSON/BindJSON (XML responses support ETag).
  • StatusCode() — read back the status code set via Status().
  • QueryValue* typed getters (QueryValueInt, QueryValueInt64, QueryValueFloat32/64, QueryValueTrimSpace[Comma]) for query-only reads, mirroring the FormValue* family.
  • FormValues / PostFormValues / QueryValues — slice getters for multi-valued fields (checkboxes, multi-select, repeated params).

⚠️ Behavior change (#114)

Registering a duplicate component name via ParseComponent / ParseComponentFile now panics with ErrComponentDuplicate instead of silently overwriting the existing component. This was a bug — the duplicate check looked at the template namespace instead of the component namespace, and now matches the Component() loader. If you relied on the silent overwrite, give the components distinct names.

Tooling & quality

  • Requires Go 1.25; dependencies upgraded — parapet, testify, minify (#112).
  • Statement coverage raised to ~97% with a substantial regression-test pass (#114).
  • Runnable example_test.go added so usage shows on pkg.go.dev (#116).
  • CI: dropped codecov, added the GitHub Actions test badge (#113).

What's Changed

  • chore: require Go 1.25, upgrade dependencies, add CLAUDE.md by @acoshift in #112
  • ci: drop codecov, add GitHub Actions test badge by @acoshift in #113
  • test: add regression tests and fix component duplicate-detection bug by @acoshift in #114
  • feat: add XML/BindXML, StatusCode getter, and query-value helpers by @acoshift in #115
  • docs: add runnable examples (example_test.go) by @acoshift in #116

Full Changelog: v1.3.0...v1.4.0

v1.3.0

Choose a tag to compare

@acoshift acoshift released this 03 Mar 04:32
9030ac1

What's Changed

  • implement cookie helper functions to context by @acoshift in #110
  • fix build part handle query from base by @acoshift in #111
  • update dependencies and go

Full Changelog: v1.2.0...v1.3.0

v1.2.0

Choose a tag to compare

@acoshift acoshift released this 23 Sep 13:56
0fdbd44

Breaking Changed

  • remove builder style

Before

app := hime.New().Address(":8080").Handler(h)
app.Template().Minify().Parse("index", "<p>index</p>")

After

app := hime.New()
app.Address(":8080")
app.Handler(h)

t := app.Template()
t.Minify()
t.Parse("index", "<p>index</p>")

What's Changed

Full Changelog: v1.1.4...v1.2.0

v1.1.4

Choose a tag to compare

@acoshift acoshift released this 07 Mar 05:31
c6ea0b5
  • change go mod version to 1.20
  • update dependencies

v1.1.3

Choose a tag to compare

@acoshift acoshift released this 21 Jul 23:00
cfa37c6
  • change go mod version to 1.17
  • update dependencies

v1.1.2

Choose a tag to compare

@acoshift acoshift released this 30 Jun 06:06
2281714

New Features

  • context: add BindJSON
  • add h2c support
  • add eTag to AppConfig

Bug Fixes

  • fix clone missing ETag field

v1.1.1

Choose a tag to compare

@acoshift acoshift released this 20 Feb 14:35
25aa47e
  • template: fix load template from fs.FS on Windows