Skip to content

Comments

fix: correct code examples against Nova/Kura source#5

Merged
Taure merged 1 commit intomainfrom
fix/source-accuracy
Feb 24, 2026
Merged

fix: correct code examples against Nova/Kura source#5
Taure merged 1 commit intomainfrom
fix/source-accuracy

Conversation

@Taure
Copy link
Contributor

@Taure Taure commented Feb 24, 2026

Summary

  • JSON API controllers: use json key (not params) for decoded JSON bodies — nova_request_plugin puts JSON into json, params is for URL-encoded form data
  • Login session flow: pass Req1 to redirect so session cookie is actually sent; use public nova_session:set/3 API instead of internal nova_session_ets:set_value/3
  • plugin_info/0: return maps (not tuples) per the nova_plugin behaviour — fixed in 3 plugin examples and the cheat sheet
  • sendfile tuple: corrected to {sendfile, StatusCode, Headers, {Offset, Length, Path}, MimeType}
  • nova_request_plugin options: replaced non-existent read_body with parse_qs
  • utc_datetime: maps to TIMESTAMPTZ (not TIMESTAMP) — fixed in schemas-migrations and cheat sheet
  • Erlang version: updated from 26 to 27 to match OTP requirement
  • Custom handler callback: corrected signature to fun(ReturnTuple, CallbackFun, Req) -> {ok, Req2}
  • Security handler docs: added {redirect, Path} and {false, StatusCode, Headers, Body} return options

Test plan

  • Verify each modified code example compiles or is consistent within its chapter
  • Cross-reference changes against Nova, Kura, and rebar3_nova source

🤖 Generated with Claude Code

Cross-referenced all chapters against actual source code and fixed:
- JSON API controllers use `json` key (not `params`) for decoded JSON bodies
- login_post/1 passes Req1 to redirect so session cookie is sent, uses public nova_session:set/3 API
- plugin_info/0 returns map (not tuple) per nova_plugin behaviour
- sendfile tuple format matches actual Nova handler signature
- nova_request_plugin options: replace non-existent read_body with parse_qs
- utc_datetime maps to TIMESTAMPTZ (not TIMESTAMP)
- Erlang version updated from 26 to 27 to match OTP requirement
- Custom handler callback signature corrected
- Security handler docs expanded with redirect and structured false returns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Taure Taure merged commit 3c44513 into main Feb 24, 2026
1 check 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.

1 participant