Thanks for the pointer-- it would be worthwhile to have the jQuery
tree and your original env.js blog post point to the new effort.

The same issue I reported above appears in the file at
http://github.com/jeresig/env-js/blob/70ed3800d7abaaff54af67e39842f4fc3e5fac61/src/env.js
My suggested fix would begin near line 677.  Again, happy to generate
and submit a patch. Please advise.

- Rhys

On Jan 26, 11:09 pm, John Resig <[email protected]> wrote:
> The env.js code there is quite quite old. I recommend checking out the
> revived effort over here:http://groups.google.com/group/envjs
>
> That code base is here:http://github.com/jeresig/env-js/tree
>
> But this is a better fork:http://github.com/thatcher/env-js/tree/master
>
> --John
>
> On Mon, Jan 26, 2009 at 4:22 PM, Rhys Ulerich <[email protected]> wrote:
>
> > While usinghttp://dev.jquery.com/browser/trunk/jquery/build/runtest/env.js
> > for some unit tests, I noticed that outgoing HTTP POST requests could
> > not have body content.  This prevents env.js from begin useful for
> > unit tests against APIs that use the POST body to contain JSON-RPC
> > information.
>
> > Specifically, look at function makeRequest() beginning on line 584 in
> > SVN trunk (link above).  You'll see near line 590 that the file: PUT
> > case uses a FileWriter to output variable 'data' to the file.  Now
> > look at the URLConnection-based code starting at line #605.  'data' is
> > never written to the outgoing HTTP request.
>
> > One possible way to fix it would be amend the block to be:
>
> >    var connection = url.openConnection();
>
> >    connection.setRequestMethod( self.method );
>
> >    // Add headers to Java connection
> >    for (var header in self.headers)
> >        connection.addRequestProperty(header, self.headers[header]);
>
> >    // Will we write content to the request?
> >    var text = new java.lang.String( data || "" );
> >    if ( text.length() > 0 ) {
> >        connection.setDoOutput(true);
> >    }
>
> >    connection.connect();
>
> >    if ( text.length() > 0 ) {
> >        // Write content to the connection's stream
> >        var out = connection.getOutputStream();
> >        out.write( text.getBytes() );
> >        out.flush();
> >        out.close();
> >    }
>
> >    // Stick the response headers into responseHeaders
> >    for (var i = 0; ; i++) {
> >        var headerName = connection.getHeaderFieldKey(i);
> >        var headerValue = connection.getHeaderField(i);
> >        if (!headerName && !headerValue) break;
> >        if (headerName)
> >            self.responseHeaders[headerName] = headerValue;
> >    }
>
> >    handleResponse();
>
> > Tested it, and it works for me atop J2SE 1.5.
>
> > I'm happy to generate and submit a patch for this.  Please advise.
>
> > - Rhys
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to