skit.define("skit.platform.netproxy:browser", ["skit.platform.net:js","skit.platform.urls:js"], function() { return ((function(skit_platform_net,skit_platform_urls) { var module = {exports: {}}; var defined = null; function define() { for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'function') { defined = arguments[i](); break; } } } define.amd = true; var result = (function skit_platform_netproxy_browser() {'use strict'; 'browser-only'; /** * @module * @ignore * @license * (c) 2014 Cluster Labs, Inc. https://cluster.co/ * License: MIT */ var net = skit_platform_net; var urls = skit_platform_urls; function sendProxied(proxyObject, method, url, headers, body, onComplete) { net.send('/__proxy__/' + proxyObject.name, { method: 'POST', params: { url: url, method: method, headers: urls.toFormEncodedString(headers || {}), body: body, csrfToken: proxyObject.csrfToken }, complete: function(response) { // unpack the response from the proxy endpoint, if it exists. var parsed = response.body || {}; var status = parsed['status'] || -1; var headers = parsed['headers'] || {}; var body = parsed['body'] || ''; onComplete(status, headers, body); } }); } module.exports = { sendProxied: sendProxied };})(); return result || defined || module.exports; })).apply(this, arguments)});