Skip to content

Commit

Permalink
fixed bug with sending a post with = sign
Browse files Browse the repository at this point in the history
read-urlencoded-request-data
has a bug in it. I have just circumvented that method
  • Loading branch information
masukomi committed Mar 16, 2022
1 parent 170df48 commit 0723ce9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/private_comments.scm
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,28 @@

(define (request->data request)
(if (request-has-message-body?)
(let ((raw-json (caar (read-urlencoded-request-data request))))
(read-json (symbol->string raw-json) )
(let ((raw-json (request-body request)))
(read-json raw-json)
)
'()))

(define (method-with-body? method)
(or (eq? 'POST method)
(eq? 'PUT method)))

(define (request-body request)
(if (method-with-body? (request-method request))
(let (
(p (request-port request))
(len (header-value 'content-length (request-headers request)))
)
(read-string len p)
)
'()))
;WARNING: only supports url-encoded post body
; not multipart


(define pc-headers
(list (list 'content-type "application/json")))

Expand Down

0 comments on commit 0723ce9

Please sign in to comment.