Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


urls inside urls #31

dlight opened this Issue · 0 comments

1 participant


I use urls as my couchdb keys (maybe this is dumb, but nevermind). so I need to do things like

PUT "/$url"

with resty.

You say on your documentation that I need to escape /; all the rest, resty will handle. I substituted / to %2F on $url. but it saves with %2F on the key name, not /; somehow resty is also escaping %, where it shouldn't.

PUT '/' '{"a": 5}'

(should return "id":"")

sending unescaped obviously doesn't help

PUT '/' '{"a": 5}'

you say -Q prevents escaping. but then somehow is saved as an attachment

PUT -Q '/' '{"a": 5}'
GET '/http:'

unfortunately your -v shows the curl response, but not the curl command line. I was able to see it using an (ugly) custom debug. then I figured out a workaround for my case:

curl -X PUT "$urlwithslashesescaped" -d "$newdoc"

so, long story short, after struggling with resty for a while, I opted to use curl directly for this request (but I'm still using resty for my other requests)

I know my case is edgy so I don't know what your tool could do for me. I produced a patch that shows curl command line with resty -v

ps: this resty tool (and jsawk) is awesome!

From 94b608b03473f2a84eb36f7314f6612611fea563 Mon Sep 17 00:00:00 2001
From: Elias Amaral <>
Date: Fri, 23 Dec 2011 23:25:35 -0300
Subject: [PATCH] adding curl command line to resty -v

 resty |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/resty b/resty
index 231155f..6111db2 100755
--- a/resty
+++ b/resty
@@ -82,6 +82,9 @@ function resty() {
       [ -n "$dat" ] && opt="--data-binary"
       [ "$method" = "HEAD" ] && opt="-I" && raw="yes"
       eval "args2=( $(cat "$confdir/$domain" 2>/dev/null |sed 's/^ *//' |grep ^$method |cut -b $((${#method}+2))-) )"
+   [[ $verbose ]] && echo curl -sLv $opt "$dat" -X $method \
+              -b "$cookies/$domain" -c "$cookies/$domain" \
+              "${args2[@]}" "${curlopt2[@]}" "${curlopt[@]}" "$_path$query" $'\n' 1>&2
       res=$((((curl -sLv $opt "$dat" -X $method \
               -b "$cookies/$domain" -c "$cookies/$domain" \
               "${args2[@]}" "${curlopt2[@]}" "${curlopt[@]}" "$_path$query" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.