conn.setDoInput(true); conn.setAllowUserInteraction(false); conn.setRequestProperty("Content-type", req.contentType()); conn.connect(); conn.getOutputStream().write(
conn.setDoInput(true); conn.setAllowUserInteraction(false); conn.setRequestProperty("Content-type", req.contentType()); conn.connect(); conn.getOutputStream().write(
hreq.addHeader(HTTP.CONTENT_TYPE, req.contentType()); } else { hreq = new HttpGet(req.url);
if (req.payloadBytes != null) throw new UnsupportedOperationException( "Raw bytes not currently supported in HTML5."); xhr.setRequestHeader("Content-Type", req.contentType()); xhr.send(req.payloadString); } else {
if (req.payloadBytes != null) throw new UnsupportedOperationException( "Raw bytes not currently supported in HTML5."); xhr.setRequestHeader("Content-Type", req.contentType()); xhr.send(req.payloadString); } else {
@Override protected RFuture<Response> execute(Builder req) { RPromise<Response> result = plat.exec().deferredPromise(); NSMutableURLRequest mreq = new NSMutableURLRequest(); mreq.setURL(new NSURL(req.url)); for (Header header : req.headers) { mreq.setHTTPHeaderField(header.name, header.value); } mreq.setHTTPMethod(req.method()); if (req.isPost()) { mreq.setHTTPHeaderField("Content-type", req.contentType()); if (req.payloadString != null) { try { mreq.setHTTPBody(new NSData(req.payloadString.getBytes("UTF-8"))); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee); } } else { mreq.setHTTPBody(new NSData(req.payloadBytes)); } } sendRequest(mreq, result); return result; }