Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GET support to RPC specification #3891

Merged
merged 38 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
41ecf38
initial commit adding GET fetch option for queries
siddhsuresh Oct 9, 2022
36fa259
semantic fixes
siddhsuresh Oct 9, 2022
a1707ba
fix type error
siddhsuresh Oct 9, 2022
332c25e
add security to other query resolvers to not allow GET Requests
siddhsuresh Oct 10, 2022
cc417ab
fix
siddhsuresh Oct 10, 2022
5acbfdb
add changeset
siddhsuresh Oct 10, 2022
6963ca9
Update apps/toolkit-app/db/migrations/20220427214932_/migration.sql
siddhsuresh Oct 10, 2022
e203bfa
Update packages/blitz-rpc/src/loader-client.ts
siddhsuresh Oct 10, 2022
8d3dfad
update pnpm-lock
siddhsuresh Oct 10, 2022
4d70c40
replace esbuild with jscodeshift
siddhsuresh Oct 10, 2022
7b1adb1
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 11, 2022
8942aa3
update pnpm-lock
siddhsuresh Oct 11, 2022
de92804
remove `@ts-ignore`
siddhsuresh Oct 11, 2022
0627097
switch to swc parser and add LRU cache to optimise reading config
siddhsuresh Oct 12, 2022
3cdf002
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 12, 2022
39e162d
remove recast from dependencies
siddhsuresh Oct 12, 2022
710e858
improve the caching logic
siddhsuresh Oct 12, 2022
919c653
add filename to hash to maintan uniqueness
siddhsuresh Oct 12, 2022
1e57f1c
remove unused import
siddhsuresh Oct 12, 2022
d8fc43d
Revert "add filename to hash to maintan uniqueness"
siddhsuresh Oct 12, 2022
92c1587
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 12, 2022
9d88f9f
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 13, 2022
f2393b7
implement suggestions
siddhsuresh Oct 13, 2022
50e0fe0
Merge branch 'add-optional-get-rpc' of https://github.com/blitz-js/bl…
siddhsuresh Oct 13, 2022
e599987
fix pnpm-lock and update changeset
siddhsuresh Oct 13, 2022
4c5c88a
remove cache and add suggesstions
siddhsuresh Oct 13, 2022
593a309
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 17, 2022
4c3bb57
fix meta being an array bug
siddhsuresh Oct 17, 2022
4564be4
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 17, 2022
a3bd2d7
make `fullRouthPath` const
siddhsuresh Oct 17, 2022
1b58f62
simplify data initialisation in `index-server`
siddhsuresh Oct 18, 2022
32d655c
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 18, 2022
e35d18e
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 19, 2022
3952c2a
remove type assersion and update with suggestion
siddhsuresh Oct 19, 2022
6ed1f02
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 19, 2022
8fec04d
Merge branch 'main' into add-optional-get-rpc
siddhsuresh Oct 28, 2022
913837a
Merge branch 'main' into add-optional-get-rpc
Oct 29, 2022
5d4e3af
pnpmlock
Oct 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions packages/blitz-rpc/src/data-client/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ export function __internal_buildRpcClient({
})

if (httpMethod === "GET") {
fullRoutePath +=
"?" +
new URLSearchParams({
params: stringify(serialized.json),
meta: stringify(serialized.meta),
})
const url = new URL(fullRoutePath, window.location.origin)
url.searchParams.set("params", stringify(serialized.json))
url.searchParams.set("meta", stringify(serialized.meta))
fullRoutePath = url.toString()
flybayer marked this conversation as resolved.
Show resolved Hide resolved
}

const promise = window
Expand Down
6 changes: 1 addition & 5 deletions packages/blitz-rpc/src/index-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,9 @@ export function rpcHandler(config: RpcConfig) {
meta: req.body.meta?.params,
})
} else {
let meta = req.query.meta
if (Array.isArray(meta)) {
meta = meta[meta.length - 1]
}
data = deserialize({
json: parse(req.query.params as string),
meta: parse(meta as string),
meta: parse(req.query.meta as string),
})
}
log.info(customChalk.dim("Starting with input:"), data ? data : JSON.stringify(data))
Expand Down