Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
fix: make sure all payload field satisfy the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lachrist committed Sep 8, 2022
1 parent 85aa14b commit 8d28927
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions components/frontend/default/payload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { fromEntries, entries: toEntries } = Object;

export default (dependencies) => {
const {
util: { constant },
util: { constant, mapMaybe },
serialization: { serialize },
} = dependencies;

Expand Down Expand Up @@ -66,10 +66,10 @@ export default (dependencies) => {
) => ({
type: "request",
side,
protocol,
method,
url,
route,
protocol: toString(protocol),
method: toString(method),
url: toString(url),
route: mapMaybe(route, toString),
headers: formatHeaders(headers),
body: serialize(serialization, body),
}),
Expand All @@ -83,9 +83,8 @@ export default (dependencies) => {
) => ({
type: "response",
side,
status,
message,
status: toInteger(status),
message: toString(message),
headers: formatHeaders(headers),
body: serialize(serialization, body),
}),
Expand All @@ -97,9 +96,9 @@ export default (dependencies) => {
parameters,
) => ({
type: "query",
database,
version,
sql,
database: mapMaybe(database, toString),
version: mapMaybe(version, toString),
sql: toString(sql),
parameters: isArray(parameters)
? parameters.map((parameter) => serialize(serialization, parameter))
: fromEntries(
Expand Down

0 comments on commit 8d28927

Please sign in to comment.