File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 114114
115115(define (request->data request)
116116 (if (request-has-message-body?)
117- (let ((raw-json (caar (read-urlencoded- request-data request) )))
118- (read-json (symbol->string raw-json) )
117+ (let ((raw-json (request-body request)))
118+ (read-json raw-json)
119119 )
120120 '()))
121121
122+ (define (method-with-body? method)
123+ (or (eq? 'POST method)
124+ (eq? 'PUT method)))
125+
126+ (define (request-body request)
127+ (if (method-with-body? (request-method request))
128+ (let (
129+ (p (request-port request))
130+ (len (header-value 'content-length (request-headers request)))
131+ )
132+ (read-string len p)
133+ )
134+ '()))
135+ ;WARNING: only supports url-encoded post body
136+ ; not multipart
137+
138+
122139(define pc-headers
123140 (list (list 'content-type "application/json")))
124141
You can’t perform that action at this time.
0 commit comments