{"_id":"xcop","_rev":"37-0df612562fe7a7d84e90a5e58e67943b","name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.1":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.1","author":{"name":"NobleJS"},"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":"MIT","repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.1","dist":{"shasum":"88299d838d8ad08f394f191b007b85560b627088","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.1.tgz","integrity":"sha512-BXxSBWsXBgEA2GcDB0G7v9F01fzRj8Xlh+uhmrRY8rHNUFBSUUR0fqEDlF80b+hF/MFXkVSZ96skuXgfOCHNpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC6ca9Sx+tMTflZo65o6ww8Dd7EZfqqCxoMMzCU/0sjKAiEApVbE2wlEd9Or5vEvFnmxItNhzrm3APqaUYJUYvnO5Y8="}]},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.2":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.2","homepage":"https://github.com/NobleJS/xcop","author":{"name":"NobleJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":{"type":"MIT","url":"http://github.com/NobleJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.2","dist":{"shasum":"185bb8709642e606f8b54f8ff1740d1968d9ae79","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.2.tgz","integrity":"sha512-QMX2WpQxuMFZzlmrK4rOKtQwrPgdZQGm/xunmkJdoZvSJv7IuS1Voo+aLP/a8sQtBkqAjnaOSEQF/WKS0KtDDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcEmcrCBoVl666ShY+aHwHlIibI25p122H8oxP5RUvGwIgH3yGgW0vGM1x5L65PgUS69Ksz9ejMyr2ZNNgQT9DaF4="}]},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.3":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.3","homepage":"https://github.com/NobleJS/xcop","author":{"name":"NobleJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":{"type":"MIT","url":"http://github.com/NobleJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.3","dist":{"shasum":"27dd5aed1b7e02f5eb454dbd21bfa0666abcc935","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.3.tgz","integrity":"sha512-2ubR/3sjoQsSVVdbM61Oif4bKWBQpPkEC/3AIcUC8EYvYkiO8KHWOZFMoIQbtkZONtfQZS2hpge0hCBskn6EQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFgGt5TAK/o++6YbwFJsCcYgYkq1fGxW7+lvrnd2G1HGAiB+CEtdDSyYqZ66/YqutPWGHET/w0H8fD+nEs4M1IXybA=="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.4":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.4","homepage":"https://github.com/NobleJS/xcop","author":{"name":"NobleJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":{"type":"MIT","url":"http://github.com/NobleJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.4","dist":{"shasum":"b5c579e8a9511950a69cef39f872a3468ea8a315","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.4.tgz","integrity":"sha512-uYGyt+zP/o2Zdufq11/n+Chs5Lk+7Sv87488eqXTrcBFD5Y9Bs/5vNZgv+VshtPXvCUwMuUMVAs6Bu09ihBFpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFbXrWRl5JzMEwliHbcDZ34tV1L7PwvkZjH2fmP6uVuoAiEA2x0vmhykuckTUxak80YJPuNUDrakR0OtMn5vU9TeXFE="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.5":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.5","homepage":"https://github.com/NobleJS/xcop","author":{"name":"NobleJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":{"type":"MIT","url":"http://github.com/NobleJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.5","dist":{"shasum":"c1e473468ccc1495e96cc249c4416af0017d90b5","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.5.tgz","integrity":"sha512-e8ukojz9J0tc5d+7DPdVgPwIg60BThFbFfo83u0dir+YjNbqnd+F/pOvCT+bP9F6q3JDgvsqIqNYOSC3TdJSSQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBNDNaEktTzr7LLHBOUFB5rEdORPw7CMHep4J0VXFfGkAiEAt/uEFWNf/B+FIAC2OAdvBvI6R2c0dCfoZmT7jqQxshY="}]},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.6":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.6","homepage":"https://github.com/NobleJS/xcop","author":{"name":"NobleJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":">= 0.8.10"},"license":{"type":"MIT","url":"http://github.com/NobleJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/NobleJS/xcop.git"},"bugs":{"url":"http://github.com/NobleJS/xcop/issues"},"main":"lib/xcop.js","_id":"xcop@0.0.6","dist":{"shasum":"725ac51fb2eb0aa2176aff572e0772293d7cceb8","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.6.tgz","integrity":"sha512-Lj4fZpGUK2wjKDDF7FOe5qrW1pTD4oWVQmPp3Skabns2G8yphaa9Y6j2eSl2Wkmz6QT6s9cWGZcNKFhZli0MzQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7w0oh9rP1jTNfpe0ankm6NPdTRCxUkwM4RqPCiRR1gAIgJmWQsO9zA2GtcDgNoWn8jZ052XrHVuN+2fOvdTEqBbE="}]},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{}},"0.0.7":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.7","homepage":"https://github.com/YuzuJS/xcop","author":{"name":"YuzuJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":"0.8.10 - 1"},"license":{"type":"MIT","url":"http://github.com/YuzuJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/YuzuJS/xcop.git"},"bugs":{"url":"http://github.com/YuzuJS/xcop/issues"},"main":"lib/xcop.js","gitHead":"6de79bee63d69d137fe36a5bae1609fcc7ce7519","_id":"xcop@0.0.7","scripts":{},"_shasum":"090faa69176cf16a35c6e07031c0d35971404b2d","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"dist":{"shasum":"090faa69176cf16a35c6e07031c0d35971404b2d","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.7.tgz","integrity":"sha512-JDIOAEtG1+Kr4j0si0IGmgxNddQO2OIE3ISIo9C8VajEgYDjBKKJCKSq9h1UxIfwsxEssWNcIEIiW0Ruz6iJng==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAzIwTjHTkzaHN3xlW1QDyUQ+mPF/gg3EzEHPCrowmFDAiBFMIgnslS9/17zy3i6mpLzfG6AcRcVaJY8FmbDACP1yQ=="}]},"directories":{}},"0.0.8":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.8","homepage":"https://github.com/YuzuJS/xcop","author":{"name":"YuzuJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":"0.8.10 - 1"},"license":{"type":"MIT","url":"http://github.com/YuzuJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/YuzuJS/xcop.git"},"bugs":{"url":"http://github.com/YuzuJS/xcop/issues"},"main":"lib/xcop.js","gitHead":"826fb3e31edc386b6978bf068e228d2b919344a7","_id":"xcop@0.0.8","scripts":{},"_shasum":"783d771bc2be16a94e1ec6831a2c51d5d386f679","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"donavon","email":"github@donavon.com"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"dist":{"shasum":"783d771bc2be16a94e1ec6831a2c51d5d386f679","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.8.tgz","integrity":"sha512-kaCaHLa7vja+1O7Lw2mp2D1t6nCjjgrwyvcY7L50oof/1GMPQJ6ILBvVmYQxywi2T/6EogdHgeIFtyWxIOgLCw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC3kXk8f8U5DTNC8EyHl71rAxptVLnZv6c/Btc7Ecx0MAiBsoUbSe27+2d0aZaTPdXchM24vhFoQqVMeenGLZLHy5A=="}]},"directories":{}},"0.0.9":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"0.0.9","homepage":"https://github.com/YuzuJS/xcop","author":{"name":"YuzuJS"},"keywords":["XHR","CORS","XMLHttpRequest"],"contributors":[{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"}],"dependencies":{"q":"^1.4.1"},"license":{"type":"MIT","url":"http://github.com/YuzuJS/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/YuzuJS/xcop.git"},"bugs":{"url":"http://github.com/YuzuJS/xcop/issues"},"main":"lib/xcop.js","gitHead":"fd59adeb50ff9bca5f8c8b639b76d4c1fb49ec91","_id":"xcop@0.0.9","scripts":{},"_shasum":"82d35b32ec6828d96b3ad62d1d1af57b5984a8e5","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"donavon","email":"github@donavon.com"},"dist":{"shasum":"82d35b32ec6828d96b3ad62d1d1af57b5984a8e5","tarball":"https://registry.npmjs.org/xcop/-/xcop-0.0.9.tgz","integrity":"sha512-VWUJX0MF/eHzBsmEStL80+4h11VdfFTBT764G2GOyQsU35EXny/5djuEc/9SJQcHpG6jG/bv7B6k0aQyxyVtsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDghi4RVDnUZgSjmNQAi05+wzf13mdkQ+HX4x1RcSG+LgIhAO5zXzUp+u/ADbF8SrIjSVL8Avq92ApecYVlHCTc8JBU"}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/xcop-0.0.9.tgz_1463060830107_0.17781076487153769"},"directories":{}},"1.0.0":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"1.0.0","homepage":"https://github.com/donavon/xcop","author":{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"},"keywords":["XHR","CORS","XMLHttpRequest"],"dependencies":{"q":"^1.4.1"},"license":{"type":"MIT","url":"http://github.com/donavon/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/donavon/xcop.git"},"bugs":{"url":"http://github.com/donavon/xcop/issues"},"main":"lib/xcop.js","gitHead":"ad10db5a7fc4bec4853495b9dc6c03b0345863bd","_id":"xcop@1.0.0","scripts":{},"_shasum":"876ce34c510fa6355a80135c12fa19a05784fe57","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"donavon","email":"github@donavon.com"},"dist":{"shasum":"876ce34c510fa6355a80135c12fa19a05784fe57","tarball":"https://registry.npmjs.org/xcop/-/xcop-1.0.0.tgz","integrity":"sha512-qHHJwn6yykspNUShFhlw4G4HNkqONyL/Df882iVrWanyu185m0J1/lDGfE87dVKqccmAKwBFNsCkZIvyxvVBvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCORVhYTbFgzxWbc1QKdwXYOmGT1Dnz33irMou2lbh+qAIhAI8A+SoWh1Vp3GV6Lk6OAPkH1p/dgMuEHDCJwOeC9Ykn"}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/xcop-1.0.0.tgz_1464358859349_0.8298718850128353"},"directories":{}},"1.0.1":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"1.0.1","homepage":"https://github.com/donavon/xcop","author":{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"},"keywords":["XHR","CORS","XMLHttpRequest"],"dependencies":{"q":"^1.4.1"},"license":{"type":"MIT","url":"http://github.com/donavon/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/donavon/xcop.git"},"bugs":{"url":"http://github.com/donavon/xcop/issues"},"main":"lib/xcop.js","gitHead":"032db1c7d65002aaaa5d257b5708e3bc5859807c","_id":"xcop@1.0.1","scripts":{},"_shasum":"b9cbbc6a8154f93c1bf91f9a6bb1e74609662b6d","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"donavon","email":"github@donavon.com"},"dist":{"shasum":"b9cbbc6a8154f93c1bf91f9a6bb1e74609662b6d","tarball":"https://registry.npmjs.org/xcop/-/xcop-1.0.1.tgz","integrity":"sha512-pH0md4xeWPNp/vcDbad3ip6rLGi9jTuEB73fhgx0u3jL965xrUB+9ogEGK9CdMnaGGb+qwHLv/eFIBvFp2j9lw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLQ6Ebw4K9xCDyvxz+vqBFgf+3Dl9+qomD1udHKTbNJgIgR/rYH1OT4ojVUNIxqKAqp3zFhZWRLQQLVxKaHUSm7Wo="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/xcop-1.0.1.tgz_1466272089802_0.8938506830018014"},"directories":{}},"1.0.2":{"name":"xcop","description":"An XHR Cross Origin Proxy allows you to make XHR requests to different friendly API services.","version":"1.0.2","homepage":"https://github.com/donavon/xcop","author":{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"},"keywords":["XHR","CORS","XMLHttpRequest"],"dependencies":{"q":"^1.4.1"},"license":{"type":"MIT","url":"http://github.com/donavon/xcop/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/donavon/xcop.git"},"bugs":{"url":"http://github.com/donavon/xcop/issues"},"main":"lib/xcop.js","gitHead":"04c88f1c33bb763376e55854079429dcc0dc906d","_id":"xcop@1.0.2","scripts":{},"_shasum":"e83a63da3443592486be14c1bf6db95b1c067d9d","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"donavon","email":"github@donavon.com"},"dist":{"shasum":"e83a63da3443592486be14c1bf6db95b1c067d9d","tarball":"https://registry.npmjs.org/xcop/-/xcop-1.0.2.tgz","integrity":"sha512-NoTUzwhbZ0a3zi4uM0HdycN8MhCInFtb01p4B7ed4aoeoLDtAYljHuul2eXV7Jjg/SR6Sj1E1HdL8cAk903hCg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDL2SymzAKpqO8l/1TfGXodz9NXDbwx5gsYyagJnBaC8gIgPT1vH9eJwnNpdrzEFLDbspoJc1oaXyzIghgKvX8mkgU="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xcop-1.0.2.tgz_1496094813271_0.7259788792580366"},"directories":{}}},"readme":"# XCOP\n\n## Introduction\n\n**XCOP** (XHR Cross Origin Proxy) allows you to make XHR requests to different friendly API services.\n\nI'm sure that you've faced this dilemma... You web application needs to \"phone home\" via XMLHttpRequest call back to\nyour site to get some information. You'd like these XHR calls to use HTTPS (maybe they contain some PII). The problem is that you've\nserved the HTML, CSS, JavaScript, and images from an HTTP server and that would constitute a cross origin call.\nHistorically, you were left with few options:\n\n1. Serve the site from the same origin as the web services.\n2. Use CORS. But this adds latency as the browser must make an additional OPTIONS request before the original request. it also requires setting up CORS headers on the server side.\n3. Use a reverse proxy server on the domain that served your HTML file. This can be, in some cases, difficult to setup, and is slower than\nhitting the destination server directly.\n\n## Enter XCOP!\n\nWith XCOP you can effectively make cross origin XHR requests with full verbs (not only GET and POST but also PUT, DELETE, PATCH, etc).\nYou can also set HTTP headers to your heart's content. Simply place a simple HTML file on the friendly cross origin server (yes, you need access\nto the server). Under the covers, XCOP package will load this into an iframe and communicate with it via PostMessage. You will need a fairly modern\nbrowser.\n\n### Install it\n\n```\n$ npm install xcop\n```\n\n### Usage\n\nXCOP us easy to use. Just call XCOP with the origin that you would like to communicate with (xcop.html must be in the root of the cross origin server).\nXCOP will return a promise that is fulfilled with an XHR object.\n\n#### Options\nYou can pass the following options as the second parameter to XCOP:\n* **useCors** - Instructs XCOP that, even if the origin is different, it should use the built-in XHR. CORS must be setup on the server to use HTTP verbs other than GET/POST and headers.\n* **proxyTimeout** - Time in seconds to wait for XCOP to be ready. (default = 15)\n* **xcopDocument** - File name of the \"xcop.html\" file on the server. Defaults to \"/xcop.html\".\n\nThe returned XHR object accepts a request object that consists of the following:\n\n* **url** - the URL that you would like to hit, relative to the origin.\n* **headers** - an object with key/value pairs.\n* **method** - the HTTP method (default = \"GET\").\n* **body** - a string containing optional data sent in a POST or PUT.\n\nIt returns a promise that is fulfilled with a response object. The response object contains the following:\n\n* **status** - the HTTP status response (ex: 200 for \"OK\")\n* **body** - the body of the response\n* **headers** - a response header object with key/value pairs.\n\n### Example\n\nLet's say that you have a web page that is loaded from http://www.example.com, but you need to post some\ndata to https://api.example.com (i.e. not on the same origin). The code below will show you how to do so.\n\n``` javascript\nvar xcop = require(\"xcop\");\n\nvar origin = \"https://api.example.com\";\nxcop(origin).done(function (xhr) {\n    var request = {\n        url: \"/items/123\",\n        headers: {\"content-type\": \"application/json\"},\n        method: \"PUT\",\n        body: JSON.stringify({id: 123, name: \"new name\"})\n    };\n    xhr(request).done(function(response) {\n        console.log(response.status + \" \" + response.body);\n    }, function (err) {\n        console.error(\"Something went wrong.\", err.message);\n    });\n}, function (err) {\n    console.error(err.message);\n});\n\n```\n\n### Live Demo\n\nYou can also see XCOP in action, live, on the Interwebs! Check out this fiddle. <http://jsfiddle.net/donavon/6tozto6v/>\n\n### Origin White Listing\n\nInstead of opening your web service up to other websites, you may now \"white list\" which origins are allowed to access your server.\nTo do so, edit the `xcop.html` file served by the destination server. By default, XCOP allows access from any origin.\n\n``` javascript\nvar whiteList = [];\n```\n\nTo setup a whitelist, replace the `whiteList` array with the list of your allows origins.\nIn our example above, you may chose to only allow http://www.example.com to use your API.\nIf so, your `xcop.html` file will read:\n\n``` javascript\nvar whiteList = [\"http://www.example.com\"];\n```\n\nYou may choose to use different `xcop.html` files with different white lists for development, QA, and production.\n\n\n### Troubleshooting\n\n**Q.** I'm getting the error \"XCOP is unavailable\".  \n**A.** You likely have not setup xcop.html in the root of the origin server that you are hitting with XCOP.\nIn the example above, that would be https://api.example.com/xcop.html\n\n**Q.** How cool is XCOP?  \n**A.** Very!\n\n### License\nFor use under [MIT license](http://github.com/donavon/xcop/raw/master/LICENSE)\n","maintainers":[{"email":"github@donavon.com","name":"donavon"},{"email":"revelcarlbergwest@gmail.com","name":"revelcw"}],"time":{"modified":"2022-06-29T04:55:16.973Z","created":"2013-10-03T02:29:08.076Z","0.0.1":"2013-10-03T02:29:09.269Z","0.0.2":"2013-10-03T19:30:11.729Z","0.0.3":"2013-10-14T14:23:40.669Z","0.0.4":"2013-10-16T01:02:38.033Z","0.0.5":"2013-11-18T17:13:30.328Z","0.0.6":"2014-02-01T23:52:07.113Z","0.0.7":"2014-12-01T17:40:44.203Z","0.0.8":"2014-12-01T18:30:39.999Z","0.0.9":"2016-05-12T13:47:12.608Z","1.0.0":"2016-05-27T14:21:01.401Z","1.0.1":"2016-06-18T17:48:12.531Z","1.0.2":"2017-05-29T21:53:34.244Z"},"author":{"name":"Donavon West","email":"email@donavon.com","url":"http://donavon.com"},"repository":{"type":"git","url":"git://github.com/donavon/xcop.git"},"readmeFilename":"README.md","homepage":"https://github.com/donavon/xcop","keywords":["XHR","CORS","XMLHttpRequest"],"bugs":{"url":"http://github.com/donavon/xcop/issues"},"license":{"type":"MIT","url":"http://github.com/donavon/xcop/raw/master/LICENSE"},"users":{"jfkhoury":true}}