~bigbes/lethe

5d910e8263ed5002b4f04c2c3fa3146dec4b6b78 — Eugene Blikh a month ago c01a501
server/web: tag Config fields for snake_case JSON output (IF1 contract)
2 files changed, 3 insertions(+), 3 deletions(-)

M internal/server/web/embed.go
M internal/server/web/embed_test.go
M internal/server/web/embed.go => internal/server/web/embed.go +2 -2
@@ 23,8 23,8 @@ var distFS embed.FS
// Config holds the values injected into the SPA's index.html as
// window.__LETHE_CONFIG__. It must not contain any tokens (IV4).
type Config struct {
	Issuer   string
	ClientID string
	Issuer   string `json:"issuer"`
	ClientID string `json:"client_id"`
}

// DistFS returns the sub-filesystem rooted at "dist" within the embedded FS.

M internal/server/web/embed_test.go => internal/server/web/embed_test.go +1 -1
@@ 31,7 31,7 @@ func TestHandler_InjectsConfigIntoIndex(t *testing.T) {
	body, _ := io.ReadAll(resp.Body)
	bodyStr := string(body)

	want := `window.__LETHE_CONFIG__={"Issuer":"http://stub","ClientID":"lethe"}`
	want := `window.__LETHE_CONFIG__={"issuer":"http://stub","client_id":"lethe"}`
	if !strings.Contains(bodyStr, want) {
		t.Errorf("body does not contain %q\nbody (first 500 chars):\n%s", want, truncate(bodyStr, 500))
	}