From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.204.112.148 with SMTP id w20cs96957bkp; Mon, 4 May 2009 21:16:45 -0700 (PDT) Received-SPF: pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.224.11.76 as permitted sender) client-ip=10.224.11.76; Authentication-Results: mr.google.com; spf=pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.224.11.76 as permitted sender) smtp.mail=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com; dkim=pass header.i=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com Received: from mr.google.com ([10.224.11.76]) by 10.224.11.76 with SMTP id s12mr9900087qas.23.1241497004133 (num_hops = 1); Mon, 04 May 2009 21:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=Rb4jyeWpTvF0aS3DV64jVvmgvQEaY8yiUrvaWsgGXsw=; b=pYrJfQi8hpjtDF+ImYHb4IEFbUxXRjf3Ei1M2dm6IXL/fyM7sUjdPGlh2HegyB6WDt BkRGZmhoC0RewHjVkaLs42TRoFXeB50XuuK/9uLBmEq8WTBvae3v/ggw4OEPID9Pe5Vq 8Hi+C3/A7kAUaIeTTPBvlW/01bDtQeANKzAWA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results :message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=6QyMecJ9qDqYGNpbJQfh7pgPxXZ7mmeqYhxZxTsxYRUNW8Ygglsjm6mOGt2M1TMop6 KXWIWHuAFhhZmu4ol06PgOjSZSx3YFIg3hHQTl3I6hs8zFt5PQeei++4uAnU2py0gu2f uz4bGn3Ijkaw4N/6P3Ys/ZxU96zWQzKJv1laI= Received: by 10.224.11.76 with SMTP id s12mr1418607qas.23.1241497003954; Mon, 04 May 2009 21:16:43 -0700 (PDT) Received: by 10.230.6.42 with SMTP id 42gr1281vbx.0; Mon, 04 May 2009 21:16:43 -0700 (PDT) X-Sender: g@spork.in X-Apparently-To: rack-devel@googlegroups.com Received: by 10.100.42.4 with SMTP id p4mr4825360anp.6.1241497002977; Mon, 04 May 2009 21:16:42 -0700 (PDT) Return-Path: Received: from plastic.spork.in (plastic.spork.in [67.207.130.88]) by gmr-mx.google.com with ESMTP id 16si972913gxk.5.2009.05.04.21.16.42; Mon, 04 May 2009 21:16:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of g@spork.in designates 67.207.130.88 as permitted sender) client-ip=67.207.130.88; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of g@spork.in designates 67.207.130.88 as permitted sender) smtp.mail=g@spork.in Received: from [10.1.1.50] (ip-118-90-111-73.xdsl.xnet.co.nz [118.90.111.73]) (Authenticated sender: tim@halorgium.net) by plastic.spork.in (Postfix) with ESMTPSA id 9284E40291 for ; Tue, 5 May 2009 16:16:40 +1200 (NZST) Message-Id: From: Tim Carey-Smith To: rack-devel@googlegroups.com Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Rack as a client-side spec Date: Tue, 5 May 2009 16:16:36 +1200 X-Mailer: Apple Mail (2.930.3) Reply-To: rack-devel@googlegroups.com Sender: rack-devel@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rack-devel@googlegroups.com; contact rack-devel+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rack-devel@googlegroups.com X-BeenThere: rack-devel@googlegroups.com Hey there, I've been dealing with the painful API that is Net::HTTP and RestClient. It seems to me that it would make sense for there to be a client lib which accepted a Rack environment and made a real HTTP request on the wire. This would return the Rack response: [status, headers, body] and allow people to build tools which worked against a real web-service as well as a Rack app. I've got an implementation for doing this using Mechanize as the backend, but it feels to weighty. As I would see it, the library would allow the following: > res = Rack::MockRequest.new(RackClient::HTTP.new).get("/foo", > "HTTP_HOST" => "example.org") Which would result in 'res' containing the data at http://example.org/foo Does this sound like a good idea? It means we can leverage the power of middleware on the client-side too. > app = Rack::Builder.app do > # For http auth > use RackClient::Auth::Basic, "username", "password" > # For json serialization > use RackClient::JSON > run RackClient::HTTP > end This could probably be wrapped in a nicer API, but I think that shows the general idea. Please tell me I'm missing something insanely stupid and this has been thought of and rejected before. (Or not...) Ciao, Tim