File tree Expand file tree Collapse file tree 8 files changed +52
-12
lines changed
Expand file tree Collapse file tree 8 files changed +52
-12
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ import './style.css'
33// import './fetch'
44// import './fn'
55import './treaty'
6- import './treaty-file'
6+ // import './treaty-file'
Original file line number Diff line number Diff line change 11/// <reference lib="dom" />
22/// <reference lib="dom.iterable" />
3- import { edenTreaty } from '@elysia/eden '
3+ import { edenTreaty } from '../../../src/treaty '
44import type { Server } from '../../server.js'
55
66export const client = edenTreaty < Server > ( 'http://localhost:8080' )
Original file line number Diff line number Diff line change 1- import { edenTreaty , EdenTreaty } from '../../../src/treaty '
1+ import { treaty , Treaty } from '../../../src/treaty2 '
22import type { Server } from '../../server'
33
4- export const client = edenTreaty < Server > ( 'http://localhost:8080' )
4+ export const client = treaty < Server > ( 'http://localhost:8080' )
55
66const { data } = await client . products . nendoroid . skadi . get ( {
7- $query : {
8- username : 'A'
7+ query : {
8+ username : 'A' ,
9+ filter : {
10+ name : 'A' ,
11+ address : 'A' ,
12+ age : 'A'
13+ }
914 }
1015} )
1116
17+ await client [ 'sign-in' ] . get ( )
18+
1219// const data = await client.products.nendoroid.skadi.post({
1320// username: 'A'
1421// })
Original file line number Diff line number Diff line change @@ -64,11 +64,33 @@ const app = new Elysia()
6464 } )
6565 } )
6666 . get ( '/sign-in' , ( ) => 'ok' )
67- . get ( '/products/nendoroid/skadi' , ( ) => 1 , {
68- query : t . Object ( {
69- username : t . String ( )
70- } )
71- } )
67+ . get (
68+ '/products/nendoroid/skadi' ,
69+ ( { query } ) => {
70+ console . log ( { query } )
71+ return query
72+ } ,
73+ {
74+ query : t . Object ( {
75+ username : t . String ( ) ,
76+ filter : t . Object ( {
77+ name : t . Optional ( t . String ( ) ) ,
78+ address : t . Optional ( t . String ( ) ) ,
79+ age : t . Optional ( t . String ( ) )
80+ } )
81+ } ) ,
82+ response : {
83+ 200 : t . Object ( {
84+ username : t . String ( ) ,
85+ filter : t . Object ( {
86+ name : t . Optional ( t . String ( ) ) ,
87+ address : t . Optional ( t . String ( ) ) ,
88+ age : t . Optional ( t . String ( ) )
89+ } )
90+ } )
91+ }
92+ }
93+ )
7294 . post ( '/products/nendoroid/skadi' , ( ) => 1 , {
7395 body : t . Object ( {
7496 username : t . String ( )
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ const eden = treaty<Server>('http://localhost:8080')
55
66const a = await eden . products . nendoroid . skadi . get ( {
77 query : {
8- username : 'a'
8+ username : 'a' ,
9+ filter : {
10+ name : 'b' ,
11+ address : 'c' ,
12+ age : '10'
13+ }
914 }
1015} )
1116
Original file line number Diff line number Diff line change @@ -196,6 +196,12 @@ const createProxy = (
196196 continue
197197 }
198198
199+ if ( typeof value === 'object' ) {
200+ append ( key , JSON . stringify ( value ) )
201+ continue
202+ }
203+
204+
199205 append ( key , `${ value } ` )
200206 }
201207 }
You can’t perform that action at this time.
0 commit comments