v0 source realm
View source
gno.land/r/moul/outfmt
A realm that returns the same data in three shapes, selected by a query
parameter. It exists to show that Render is a general response builder and
not only a Markdown emitter.
| path | output |
|---|---|
"" |
an index of the three formats |
?fmt=stringer |
human-readable text (the default) |
?fmt=json |
a JSON object |
?fmt=jsonp |
the same JSON wrapped in callback(...) |
Anything else panics.
1gnokey query vm/qrender -data 'gno.land/r/moul/outfmt:?fmt=json' \
2 -remote https://rpc.gno.land:443
The payload is a Result (a number, a text, a slice of numbers) drawn from a
package-level math/rand source with a fixed seed (rand.NewPCG(0, 0)). A
Render call is a query, so the draws it makes are never committed.
Known rough edges
Both are marked FIXME in the source and are kept as-is, because they are the
interesting part:
- The query string is split by hand on
?and=instead of going throughnet/url, so?fmt=json&x=1does not parse. - Nothing can set a content type. A realm returns a string; the JSON variant is
JSON only by convention, and the
jsonpcallback name is hardcoded tocallbackrather than read from the query.
A realm cannot negotiate content properly today. That limitation is what this realm documents.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
Dependency graph:

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.