Welcome to the CHICKEN Scheme pasting service

http-client: (prepare-request) added by caolanm on Tue Aug 22 14:29:11 2017

Index: http-client.scm
===================================================================
--- http-client.scm	(revision 34324)
+++ http-client.scm	(working copy)
@@ -43,7 +43,8 @@
      basic-authenticator digest-authenticator
      determine-username/password determine-proxy
      determine-proxy-from-environment determine-proxy-username/password
-     server-connector default-server-connector)
+     server-connector default-server-connector
+     prepare-request default-prepare-request)
 
 (import chicken scheme lolevel)
 (use srfi-1 srfi-13 srfi-18 srfi-69
@@ -280,6 +281,10 @@
 
 (define server-connector (make-parameter default-server-connector))
 
+(define default-prepare-request identity)
+
+(define prepare-request (make-parameter default-prepare-request))
+
 (define (ensure-connection! uri)
   (or (grab-idle-connection! uri)
       (let ((proxy ((determine-proxy) uri)))
@@ -600,7 +605,8 @@
                               req-uri
                               (update-uri req-uri host: #f port: #f scheme: #f
                                           path: (or (uri-path req-uri) '(/ "")))))
-                 (request (write-request (update-request req uri: req-uri)))
+                 (request (write-request ((prepare-request)
+                                          (update-request req uri: req-uri))))
                  ;; Writer should be prepared to be called several times
                  ;; Maybe try and figure out a good way to use the
                  ;; "Expect: 100-continue" header to prevent too much writing?

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Type in the text below:
 _                    
| | ____  _____  __ _ 
| |/ /\ \/ / _ \/ _` |
|   <  >  <  __/ (_| |
|_|\_\/_/\_\___|\__, |
                   |_|
Visually impaired? Let me spell it for you (wav file) download WAV