Re: [Chicken-users] rest-bind request headers support

2015-03-29 Thread Kooda
On Sun, Mar 29, 2015 at 01:37:00PM +0100, Andy Bennett wrote:
 Hi,
 
 Thanks Kooda!
 
 I seem to have noticed this too but didn't actually push my changes!
 Our patches are very similar but mine respects the entire request object
 if passed by the user.

That’s what I wanted to do as well, but I just made a quick patch so I
could try rest-bind for my project.


 Please can you try it and let me know if it works for you?
 The repository is at ssh://g...@bitbucket.org/knodium/rest-bind.git
 
 If it works then I'll cut a release, if not I'll apply your patch
 instead and cut a release.
 

I should have tried this version right away, it works perfectly. :)

Thanks a lot!

-- 
Envoyé depuis ma GameBoy.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] rest-bind request headers support

2015-03-28 Thread Kooda
Hi,

I’m trying to use rest-bind for a project and need to be able to add
some headers to the http requests, which rest-bind didn’t permit, even
when passing a request object.

Here is a simple patch that fixes this issue:

--- rest-bind.scm.orig  2015-03-29 00:26:49.0 +0100
+++ rest-bind.scm   2015-03-29 00:24:43.0 +0100
@@ -94,7 +94,9 @@
   (else (uri-reference uri/req
(method  (cond ((request? uri/req) (request-method 
uri/req))
   (writer 'POST)
-  (else 'GET
+  (else 'GET)))
+   (headers (cond ((request? uri/req) (request-headers 
uri/req))
+  (else (headers '())
   (lambda ,proc-args
 (let* (,@(if (not (null? uri-args))
  `((uri (update-uri uri path: (append (uri-path 
uri) (map -string (list ,@uri-args)
@@ -109,7 +111,7 @@

 ,param)))

  params))
   '())
-  (req (make-request uri: uri method: method)) ; poke 
the args into query string.
+  (req (make-request uri: uri method: method headers: 
headers)) ; poke the args into query string.
   )
   (receive (reader uri response)
(call-with-input-request req ,(if writer 
'(writer body) #f) ,reader)

-- 
Envoyé depuis ma GameBoy.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users