From a3c42bd53568cfb4c1750c999f5a1468e2dfa662 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Fri, 22 Mar 2013 14:48:13 -0400 Subject: [PATCH] rest.js is now part of Cujo.js --- .travis.yml | 4 +- CONTRIBUTING.md | 99 ++++--------------- LICENSE.txt | 11 ++- README.md | 45 ++++----- UrlBuilder.js | 21 +--- client/jsonp.js | 21 +--- client/node.js | 22 +---- client/xdr.js | 21 +--- client/xhr.js | 21 +--- docs/README.md | 4 +- docs/dojo.md | 4 +- docs/interceptors.md | 6 +- docs/wire.md | 4 +- dojo/RestStore.js | 21 +--- dojo/SimpleRestStore.js | 21 +--- dojo/wire.js | 21 +--- interceptor.js | 21 +--- interceptor/basicAuth.js | 21 +--- interceptor/defaultRequest.js | 21 +--- interceptor/entity.js | 21 +--- interceptor/errorCode.js | 21 +--- interceptor/hateoas.js | 21 +--- interceptor/ie/xdomain.js | 21 +--- interceptor/ie/xhr.js | 21 +--- interceptor/jsonp.js | 21 +--- interceptor/location.js | 21 +--- interceptor/mime.js | 21 +--- interceptor/oAuth.js | 21 +--- interceptor/pathPrefix.js | 21 +--- interceptor/retry.js | 22 +---- interceptor/timeout.js | 22 +---- mime/registry.js | 21 +--- mime/type/application/json.js | 21 +--- .../type/application/x-www-form-urlencoded.js | 21 +--- mime/type/text/plain.js | 21 +--- package.json | 8 +- rest.js | 21 +--- test/UrlBuilder-test.js | 21 +--- test/buster.js | 21 +--- test/client/jsonp-test-browser.js | 33 ++----- test/client/node-test-node.js | 40 +++----- test/client/xdr-test-browser.js | 37 +++---- test/client/xhr-test-browser.js | 39 +++----- test/curl-config.js | 21 +--- test/dojo/RestStore-test-browser.js | 43 +++----- test/dojo/wire-test-browser.js | 29 ++---- test/failOnThrow.js | 21 +--- test/interceptor-test.js | 71 ++++++------- test/interceptor/basicAuth-test.js | 29 ++---- test/interceptor/defaultRequest-test.js | 45 +++------ test/interceptor/entity-test.js | 27 ++--- test/interceptor/errorCode-test.js | 29 ++---- test/interceptor/hateoas-test.js | 31 ++---- test/interceptor/ie/xdomain-test-browser.js | 31 ++---- test/interceptor/ie/xhr-test-browser.js | 27 ++--- test/interceptor/jsonp-test.js | 27 ++--- test/interceptor/location-test.js | 27 ++--- test/interceptor/mime-test.js | 37 +++---- test/interceptor/oAuth-test.js | 27 ++--- test/interceptor/pathPrefix-test.js | 31 ++---- test/interceptor/retry-test.js | 30 ++---- test/interceptor/timeout-test.js | 38 +++---- test/mime/registry-test.js | 35 ++----- test/mime/type/application/json-test.js | 21 +--- .../application/x-www-form-urlencoded-test.js | 21 +--- test/mime/type/text/plain-test.js | 21 +--- test/run.js | 21 +--- test/util/base64-test.js | 21 +--- test/util/beget-test.js | 21 +--- test/util/mixin-test.js | 21 +--- test/util/normalizeHeaderName-test.js | 21 +--- test/util/pubsub-test.js | 21 +--- test/version-test-node.js | 21 +--- test/wire-test.js | 49 ++++----- util/base64.js | 2 +- util/beget.js | 21 +--- util/mixin.js | 21 +--- util/normalizeHeaderName.js | 21 +--- util/pubsub.js | 21 +--- wire.js | 21 +--- 80 files changed, 446 insertions(+), 1543 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8aff188..a29e887 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,5 @@ script: npm run-script ci env: global: - BUSTER_TEST_OPT="--reporter specification" - - SELENIUM_USERNAME=s2js-rest - - secure: "jMkfzJLwEdNVNkFDdc/slTTopqJR4uoUsGElmrChrzj3wr9x8Yy2Cu1gYcLx\navO9g6Rw4DzN8uVwFLufr8aTbfMtdN7fUZWC3SdCXpTu15b6hm6Zp7wvqhWp\nlPT6QSZbKtw7h5++ffh2SvLln2JPwghbxrEI31quIXQhefDA/0Y=" + - SELENIUM_USERNAME=cujojs-rest + - secure: "kxs2tHuJ3Vd1lO/mBoUJ5EpLdojYuAsCGm7xP03VVjuuJs7zf1gux3xx3e+5\nb2LaZL4p4/rPmkPaYGNmh/FE2XrmcAejF1bSKyX0VLD0LUPnB/afwWMF1vvI\nupa+JAXxNlM2tNaK+TiLdq0uFhjs8GyTdxHm9jujdzOmGf7IF8o=" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e77169..fd88318 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ -_Have something you'd like to contribute to the framework? We welcome pull -requests, but ask that you carefully read this document first to understand how -best to submit them; what kind of changes are likely to be accepted; and what -to expect from the Spring team when evaluating your submission._ +_Thanks for your interest in rest.js. Have something you'd like to contribute? +We welcome pull requests, but ask that you read this document first to +understand how best to submit them; what kind of changes are likely to be +accepted; and what to expect from the team when evaluating your submission._ _Please refer back to this document as a checklist before issuing any pull request; this will save time for everyone!_ @@ -24,29 +24,10 @@ truly trivial, e.g. typo fixes, removing compiler warnings, etc. ## Discuss non-trivial contribution ideas with committers If you're considering anything more than correcting a typo or fixing a minor -bug, please discuss it on the [s2js-contrib][] mailing list before submitting a -pull request. We're happy to provide guidance but please research the subject -on your own including searching the mailing list for prior discussions. - - -## Sign the Contributor License Agreement - -If you have not previously done so, please fill out and submit the -[s2js CLA form][]. You'll receive a token when this process is complete. Keep -track of this; you may be asked for it later! - -Note that emailing/postal mailing a signed copy is _not_ necessary. Submission -of the web form is all that is required. - -Once you've completed the web form, simply add the following in a comment on -your pull request: - - I have signed and agree to the terms of the s2js Contributor License - Agreement. - -You do not need to include your token/id. Please add the statement above to all -future pull requests as well, simply so that the team knows immediately that -this process is complete. +bug, please discuss it on the cujojs [mailing list][], or the #cujojs IRC +channel on freenode, before submitting a pull request. We're happy to provide +guidance but please research the subject on your own including searching the +mailing list for prior discussions. ## Create your branch from `dev` @@ -84,35 +65,23 @@ present in the framework. 1. Preserve existing formatting; i.e. do not reformat code for its own sake 1. Search the codebase using `git grep` and other tools to discover common naming conventions, etc. -1. ascii encoding for JS sources, escape special characters +1. utf8 encoding for JS sources, escape special characters -## Add MIT license header to all new source files +## Add MIT license block to all new source files ```javascript /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author FirstName LastName */ ``` +If you are uncomfortable making the contribution under the MIT license, please +contact us before making a contribution. + ## Update license header to modified files as necessary @@ -120,13 +89,13 @@ Always check the date range in the license header. For example, if you've modified a file in 2013 whose header still reads ```javascript - * Copyright (c) 2012 VMware, Inc. + * Copyright 2012 the original author or authors ``` then be sure to update it to 2013 appropriately ```javascript - * Copyright (c) 2012-2013 VMware, Inc. + * Copyright 2012-2013 the original author or authors ``` @@ -159,33 +128,6 @@ there are many resources online to help you understand how these tools work. Here is one: http://book.git-scm.com/4_interactive_rebasing.html. -## Use real name in git commits - -Please configure git to use your real first and last name for any commits you -intend to submit as pull requests. For example, this is not acceptable: - - Author: Nickname - -Rather, please include your first and last name, properly capitalized, as -submitted against the SpringSource contributor license agreement: - - Author: First Last - -This helps ensure traceability against the CLA, and also goes a long way to -ensuring useful output from tools like `git shortlog` and others. - -You can configure this globally via the account admin area GitHub (useful for -fork-and-edit cases); globally with - - git config --global user.name "First Last" - git config --global user.email user@mail.com - -or for the local repository only by omitting the '--global' flag: - - git config user.name "First Last" - git config user.email user@mail.com - - ## Format commit messages Please read and follow the [commit guidelines section of Pro Git][]. @@ -283,8 +225,7 @@ issue a new pull request when asked to make changes. [help documentation]: http://help.github.com/send-pull-requests -[issue tracker]: https://github.com/s2js/rest/issues -[s2js-contrib]: https://groups.google.com/forum/#!forum/s2js-contrib -[s2js CLA form]: http://support.springsource.com/spring_s2js_signup +[issue tracker]: https://github.com/cujojs/rest/issues +[mailing list]: https://groups.google.com/forum/#!forum/cujojs [fork-and-edit]: https://github.com/blog/844-forking-with-the-edit-button [commit guidelines section of Pro Git]: http://progit.org/book/ch5-2.html#commit_guidelines diff --git a/LICENSE.txt b/LICENSE.txt index 0de6dc5..13cbef8 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. +Copyright (c) 2012-2013 the original author or authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -17,3 +17,12 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +--- + +Code published by Scott Andrews or Jeremy Grelle is copyright VMware. + +VMware, Inc. +3401 Hillview Avenue +Palo Alto, CA 94304 diff --git a/README.md b/README.md index 86bcff3..6223d3c 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,28 @@ -Rest.js +rest.js ======= -Just enough client, as you need it. Make HTTP requests from a browser or Node.js applying the only the client features you need. Configure a client once, and share it safely throughout your application. Easily extend with interceptors that wrap the request and/or response, or MIME type converters for rich data formats. +Just enough client, as you need it. Make HTTP requests from a browser or Node.js applying only the client features you need. Configure a client once, and share it safely throughout your application. Easily extend with interceptors that wrap the request and/or response, or MIME type converters for rich data formats. Build Status ------------ - - + +
Master
Development
Master
Development
Usage ----- -Using Rest.js is easy. The core clients provide limited functionality around the request and response lifecycle. The input and response objects are normalized to support portability between browser and server environments. +Using rest.js is easy. The core clients provide limited functionality around the request and response lifecycle. The request and response objects are normalized to support portability between different JavaScript environments. -The response from a client is a promise that is resolved when the remote request finishes. +The return value from a client is a promise that is resolved with the response when the remote request finishes. -The core client behavior can be augmented with interceptors. An interceptor wraps the client and transforms the request and response. For example: an interceptor may authenticate a request, or reject the promise if an error is encountered. Interceptors may be combined to create a client with the desired behavior. A configured interceptor acts just like a client. The default client is dumb, it only know the low level mechanics of making a request and parsing the response. All other behavior is applied and configurated with interceptors. +The core client behavior can be augmented with [interceptors](docs/interceptors.md#interceptor-principals). An interceptor wraps the client and transforms the request and response. For example: an interceptor may authenticate a request, or reject the promise if an error is encountered. Interceptors may be combined to create a client with the desired behavior. A configured interceptor acts just like a client. The core clients are basic, they only know the low level mechanics of making a request and parsing the response. All other behavior is applied and configurated with interceptors. -Interceptors are applied to a client by chaining. To chain a client with an interceptor to a client, call the `chain` function on the client providing the interceptor behavior and optionally a configuration object. A new client is returned containing the new behavior applied to the client. It's important to note that the behavior of the original client is not modified, in order to use the new behavior, you must use the returned client. +Interceptors are applied to a client by chaining. To chain a client with an interceptor, call the `chain` function on the client providing the interceptor and optionally a configuration object. A new client is returned containing the interceptor's behavior applied to the parent client. It's important to note that the behavior of the original client is not modified, in order to use the new behavior, you must use the returned client. ### Making a basic request: ### @@ -42,7 +42,7 @@ The response should look familiar as well, it contains all the fields you would ### Working with JSON: ### -If you paid attention when executing the previous example, you may have noticed that the response.entity is a string. Often we work with more complex data types. For this, Rest.js supports a rich set of MIME type conversions with the `mime` interceptor. The correct converter will automatically be chosen based on the `Content-Type` response header. Custom converts can be registered for a MIME type, more on that later... +If you paid attention when executing the previous example, you may have noticed that the response.entity is a string. Often we work with more complex data types. For this, rest.js supports a rich set of [MIME type conversions](docs/mime.md) with the [MIME Interceptor](docs/interceptors.md#module-rest/interceptor/mime). The correct converter will automatically be chosen based on the `Content-Type` response header. Custom converts can be registered for a MIME type, more on that later... ```javascript var rest, mime, client; @@ -80,16 +80,16 @@ client({ path: '/data.json' }).then( ); ``` -In this example, we take the client create by the `mime` interceptor, and wrap it with the `errorCode` interceptor. The errorCode interceptor accepts a configuration object that indicates what status codes should be considered an error. In this case we override the default value of <=400, to only reject with 500 or greater status code. +In this example, we take the client create by the [MIME Interceptor](docs/interceptors.md#module-rest/interceptor/mime), and wrap it with the [Error Code Interceptor](https://github.com/s2js/rest/blob/cujojs/docs/interceptors.md#module-rest/interceptor/errorCode). The error code interceptor accepts a configuration object that indicates what status codes should be considered an error. In this case we override the default value of <=400, to only reject with 500 or greater status code. -Since the errorCode interceptor can reject the response promise, we also add a second handler function to receive the response for requests in error. +Since the error code interceptor can reject the response promise, we also add a second handler function to receive the response for requests in error. Clients can continue to be composed with interceptors as needed. At any point the client as configured can be shared. It is safe to share clients and allow other parts of your application to continue to compose other clients around the shared core. Your client is protected from additional interceptors that other parts of the application may add. ### Declarative Interceptor Composition: ### -First class support is provided for declaratively composing interceptors using [wire.js](https://github.com/cujojs/wire). Wire is an dependency injection container; you specify how the parts of your application interrelate and wire takes care of the dirty work to make it so. +First class support is provided for [declaratively composing interceptors using wire.js](docs/wire.md). wire.js is an dependency injection container; you specify how the parts of your application interrelate and wire takes care of the dirty work to make it so. Let's take the previous example and configure the client using a wire specification instead of imperative code. @@ -129,7 +129,7 @@ registry.register('application/vnd.com.example', { }); ``` -Registering a custom converter is a simple as calling the register function on the mime registry with the type and converter. A converter has just two methods: `read` and `write`. Read converts a String to a more complex Object. Write converts an Object back into a String to be sent to the server. HTTP is fundamentally a text based protocol after all. +Registering a custom converter is a simple as calling the register function on the [mime registry](docs/mime.md#module-rest/mime/registry) with the type and converter. A converter has just two methods: `read` and `write`. Read converts a String to a more complex Object. Write converts an Object back into a String to be sent to the server. HTTP is fundamentally a text based protocol after all. Built in converters are available under `rest/mime/type/{type}`, as an example, JSON support is located at `rest/mime/type/application/json`. You never need to know this as a consumer, but it's a good place to find examples. @@ -149,13 +149,13 @@ Tested environments: - Safari (5, 6, iOS 4-6, should work in earlier versions) - Opera (11, 12, should work in earlier versions) -Specific browser test are provided by [Travis CI](https://travis-ci.org/s2js/rest) and [Sauce Labs' Open Sauce Plan](https://saucelabs.com/opensource). You can see [specific browser test results](https://saucelabs.com/u/s2js-rest), although odds are they do not reference this specific release/branch/commit. +Specific browser test are provided by [Travis CI](https://travis-ci.org/cujojs/rest) and [Sauce Labs' Open Sauce Plan](https://saucelabs.com/opensource). You can see [specific browser test results](https://saucelabs.com/u/cujojs-rest), although odds are they do not reference this specific release/branch/commit. Getting Started --------------- -Rest can be installed via [npm](https://npmjs.org/), [Bower](http://twitter.github.com/bower/), or from source. +rest.js can be installed via [npm](https://npmjs.org/), [Bower](http://twitter.github.com/bower/), or from source. To install without source: @@ -169,9 +169,9 @@ From source: $ npm install -Rest.js is designed to run in a browser environment, utilizing [AMD modules](https://github.com/amdjs/amdjs-api/wiki/AMD), or within [Node.js](http://nodejs.org/). [curl](https://github.com/cujojs/curl) is highly recommended as an AMD loader, although any loader should work. +rest.js is designed to run in a browser environment, utilizing [AMD modules](https://github.com/amdjs/amdjs-api/wiki/AMD), or within [Node.js](http://nodejs.org/). [curl.js](https://github.com/cujojs/curl) is highly recommended as an AMD loader, although any loader should work. -An ECMAScript 5 compatible environment is assumed. Older browsers, ::cough:: IE, that do not support ES5 natively can be shimmed. Any shim should work, although we've tested against cujo's [poly](https://github.com/cujojs/poly) +An ECMAScript 5 compatible environment is assumed. Older browsers, ::cough:: IE, that do not support ES5 natively can be shimmed. Any shim should work, although we've tested against cujo's [poly.js](https://github.com/cujojs/poly) Documentation @@ -183,7 +183,7 @@ Full project documentation is available in the [docs directory](docs). Reporting Issues ---------------- -Please report issues on [GitHub](https://github.com/s2js/rest/issues). Include a brief description of the error, information about the runtime (including shims) and any error messages. +Please report issues on [GitHub](https://github.com/cujojs/rest/issues). Include a brief description of the error, information about the runtime (including shims) and any error messages. Feature requests are also welcome. @@ -219,19 +219,16 @@ Please see CONTRIBUTING.md for details on how to contribute to this project. Copyright --------- -Rest.js is made available under the MIT license. See LICENSE.txt for details. +Copyright 2012-2013 the original author or authors -Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. - -VMware, Inc. -3401 Hillview Avenue -Palo Alto, CA 94304 +rest.js is made available under the MIT license. See LICENSE.txt for details. Change Log ---------- .next +- moving from the 's2js' to the 'cujojs' organization - Dropping Node 0.6 support - Interceptor configuration chaining - wire.js factory diff --git a/UrlBuilder.js b/UrlBuilder.js index 9dfba6b..3a9ccff 100644 --- a/UrlBuilder.js +++ b/UrlBuilder.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, location) { diff --git a/client/jsonp.js b/client/jsonp.js index a6528d5..e6bc451 100644 --- a/client/jsonp.js +++ b/client/jsonp.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, global, document) { diff --git a/client/node.js b/client/node.js index fec9045..5450e33 100644 --- a/client/node.js +++ b/client/node.js @@ -1,23 +1,9 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (define) { diff --git a/client/xdr.js b/client/xdr.js index 45b00ce..382b018 100644 --- a/client/xdr.js +++ b/client/xdr.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, XDomainRequest) { diff --git a/client/xhr.js b/client/xhr.js index 0a870ea..576fe68 100644 --- a/client/xhr.js +++ b/client/xhr.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, global) { diff --git a/docs/README.md b/docs/README.md index 0006ba7..ad74c24 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Rest.js +# rest.js Documentation ## Core Facilities @@ -25,7 +25,7 @@ Support for serializing/deserializing objects to/from HTTP requests/responses. ## Optional Libraries -[Wire.js](wire.md) +[wire.js](wire.md) Declarative client configuration with wire.js. diff --git a/docs/dojo.md b/docs/dojo.md index c91d52c..b8c325b 100644 --- a/docs/dojo.md +++ b/docs/dojo.md @@ -1,6 +1,6 @@ # Dojo Toolkit -Dojo provides a common [Store API](http://dojotoolkit.org/reference-guide/1.8/dojo/store.html) for data store operations. Rest.js provides two implementations of these APIs that use a rest client under the hood. Typical Dojo stores include an in memory `MemoryStore` or the ever popular `JsonRest`. The issue with JsonRest is fundamentally that it presumes the mechanics of the request and response. If your server doesn't fit the convention it expects, you're out of luck. Rest.js doesn't presume to force a particular content type, or structure. Any client can be wrapped to provide the full power and flexibility of rest.js with the Dojo Store API. +Dojo provides a common [Store API](http://dojotoolkit.org/reference-guide/1.8/dojo/store.html) for data store operations. rest.js provides two implementations of these APIs that use a rest client under the hood. Typical Dojo stores include an in memory `MemoryStore` or the ever popular `JsonRest`. The issue with JsonRest is fundamentally that it presumes the mechanics of the request and response. If your server doesn't fit the convention it expects, you're out of luck. rest.js doesn't presume to force a particular content type, or structure. Any client can be wrapped to provide the full power and flexibility of rest.js with the Dojo Store API. @@ -28,7 +28,7 @@ Extends `SimpleRestStore` providing enhanced support for queries via [Dojo's Que -### Wire.js +### wire.js `rest/dojo/wire` ([src](../dojo/wire.js)) diff --git a/docs/interceptors.md b/docs/interceptors.md index 1019b7a..8ac4b5f 100644 --- a/docs/interceptors.md +++ b/docs/interceptors.md @@ -39,7 +39,7 @@ ## Incerceptor Principals -Rest.js distinguishes itself from other HTTP client libraries by providing a minimal core that can be wrapped by more advanced behavior. These configured clients can then be consumed by our application. If a portion of our application needs more advanced behavior, it can continue to wrap the client without impacting other portions of the application. Functional programming FTW. +rest.js distinguishes itself from other HTTP client libraries by providing a minimal core that can be wrapped by more advanced behavior. These configured clients can then be consumed by our application. If a portion of our application needs more advanced behavior, it can continue to wrap the client without impacting other portions of the application. Functional programming FTW. Each [interceptor](interfaces.md#interface-interceptor) is a function that optionally accepts a parent [client](interfaces.md#interface-client) and some configuration returning a new [client](interfaces.md#interface-client). @@ -494,7 +494,7 @@ Support for the OAuth implicit flow. In a separate window users are redirected **TIP:** A client request may take a very long time to respond while the user is being prompted to authenticate. Once the user returns to the app, the original request is made with the new access token. If an access token expires, the next request may take a similarly long time to respond as a new token is obtained from the authorization server. The oAuth interceptor should typically be after time sensitive interceptors such as timeout. -**IMPORTANT:** Rest.js is only able to provide part of the client flow. When the user is redirected back from the authentication server, the application server must handle the initial request and provide an HTML page with the scripts to parse the URL fragment containing the access token and provide the token to the callback function. As rest.js is not a server side web framework, it is unable to provide support for this part of the oAuth flow. +**IMPORTANT:** rest.js is only able to provide part of the client flow. When the user is redirected back from the authentication server, the application server must handle the initial request and provide an HTML page with the scripts to parse the URL fragment containing the access token and provide the token to the callback function. As rest.js is not a server side web framework, it is unable to provide support for this part of the oAuth flow. **Phases** @@ -584,7 +584,7 @@ client({ path: 'http://resourceserver.example.com' }).then(function (response) { `rest/interceptor/errorCode` ([src](../interceptor/errorCode.js)) -Marks a response as an error based on the status code. According to the HTTP spec, 5xx status codes are server errors, 4xx codes are client errors. Rest.js by default will treat any response from a server as successful, this allows interceptors to define what constitutes an error. The errorCode interceptor will mark a request in error if the status code is equal or greater than the configured value. +Marks a response as an error based on the status code. According to the HTTP spec, 500s status codes are server errors, 400s codes are client errors. rest.js by default will treat any response from a server as successful, this allows interceptors to define what constitutes an error. The errorCode interceptor will mark a request in error if the status code is equal or greater than the configured value. **Phases** diff --git a/docs/wire.md b/docs/wire.md index e286ff5..437960d 100644 --- a/docs/wire.md +++ b/docs/wire.md @@ -1,6 +1,6 @@ -# Wire.js +# wire.js -[Wire.js](https://github.com/cujojs/wire/) is an Inversion of Control container that allows applications to be composed together at runtime based on a declarative configuration. A rest.js plugin is provided for wire that enables declarative configuration of rest clients, including chaning interceptors with their configuration. +[wire.js](https://github.com/cujojs/wire/) is an Inversion of Control container that allows applications to be composed together at runtime based on a declarative configuration. A rest.js plugin is provided for wire that enables declarative configuration of rest clients, including chaning interceptors with their configuration. diff --git a/dojo/RestStore.js b/dojo/RestStore.js index 99d34d2..30adddb 100644 --- a/dojo/RestStore.js +++ b/dojo/RestStore.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/dojo/SimpleRestStore.js b/dojo/SimpleRestStore.js index f27d866..1c738c4 100644 --- a/dojo/SimpleRestStore.js +++ b/dojo/SimpleRestStore.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/dojo/wire.js b/dojo/wire.js index d3e222e..21e1481 100644 --- a/dojo/wire.js +++ b/dojo/wire.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor.js b/interceptor.js index e6816ee..dddb1f4 100644 --- a/interceptor.js +++ b/interceptor.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/basicAuth.js b/interceptor/basicAuth.js index df614ad..6eff739 100644 --- a/interceptor/basicAuth.js +++ b/interceptor/basicAuth.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/defaultRequest.js b/interceptor/defaultRequest.js index 93ce02d..6ee2c28 100644 --- a/interceptor/defaultRequest.js +++ b/interceptor/defaultRequest.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/entity.js b/interceptor/entity.js index b659996..a2d591c 100644 --- a/interceptor/entity.js +++ b/interceptor/entity.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/errorCode.js b/interceptor/errorCode.js index 635914b..5f32ca5 100644 --- a/interceptor/errorCode.js +++ b/interceptor/errorCode.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/hateoas.js b/interceptor/hateoas.js index c81dbc0..dfbb43c 100644 --- a/interceptor/hateoas.js +++ b/interceptor/hateoas.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/ie/xdomain.js b/interceptor/ie/xdomain.js index 443bfb8..3085ad6 100644 --- a/interceptor/ie/xdomain.js +++ b/interceptor/ie/xdomain.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/ie/xhr.js b/interceptor/ie/xhr.js index e019041..fa3ca14 100644 --- a/interceptor/ie/xhr.js +++ b/interceptor/ie/xhr.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, global) { diff --git a/interceptor/jsonp.js b/interceptor/jsonp.js index 7f649a4..5c97fab 100644 --- a/interceptor/jsonp.js +++ b/interceptor/jsonp.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/location.js b/interceptor/location.js index 177e76e..6e95902 100644 --- a/interceptor/location.js +++ b/interceptor/location.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/mime.js b/interceptor/mime.js index 26f3444..89f24b6 100644 --- a/interceptor/mime.js +++ b/interceptor/mime.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/oAuth.js b/interceptor/oAuth.js index 018917f..b0db3d2 100644 --- a/interceptor/oAuth.js +++ b/interceptor/oAuth.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, global) { diff --git a/interceptor/pathPrefix.js b/interceptor/pathPrefix.js index e0e57e5..ac60d04 100644 --- a/interceptor/pathPrefix.js +++ b/interceptor/pathPrefix.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/retry.js b/interceptor/retry.js index d2e6bb3..ce57a7f 100644 --- a/interceptor/retry.js +++ b/interceptor/retry.js @@ -1,23 +1,9 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (define) { diff --git a/interceptor/timeout.js b/interceptor/timeout.js index ec996c4..099964b 100644 --- a/interceptor/timeout.js +++ b/interceptor/timeout.js @@ -1,23 +1,9 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (define) { diff --git a/mime/registry.js b/mime/registry.js index 5bb3882..aa85f4a 100644 --- a/mime/registry.js +++ b/mime/registry.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/mime/type/application/json.js b/mime/type/application/json.js index 8539f7e..1ef26e6 100644 --- a/mime/type/application/json.js +++ b/mime/type/application/json.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/mime/type/application/x-www-form-urlencoded.js b/mime/type/application/x-www-form-urlencoded.js index 488b4eb..382a766 100644 --- a/mime/type/application/x-www-form-urlencoded.js +++ b/mime/type/application/x-www-form-urlencoded.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/mime/type/text/plain.js b/mime/type/text/plain.js index ffce26c..20c8cc0 100644 --- a/mime/type/text/plain.js +++ b/mime/type/text/plain.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/package.json b/package.json index 5029150..99eda79 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "rest", "version": "0.8.4-next", - "description": "HTTP client library inspired by the Spring Framework's RestTemplate", - "keywords": ["rest", "http", "client", "rest-template", "spring", "s2js"], + "description": "RESTful HTTP client library", + "keywords": ["rest", "http", "client", "rest-template", "spring", "cujojs"], "licenses": [ { "type": "MIT", @@ -12,10 +12,10 @@ "repositories": [ { "type": "git", - "url": "https://github.com/s2js/rest" + "url": "https://github.com/cujojs/rest" } ], - "bugs": "https://github.com/s2js/rest/issues", + "bugs": "https://github.com/cujojs/rest/issues", "maintainers": [ { "name": "Scott Andrews", diff --git a/rest.js b/rest.js index 9ded42d..9372236 100644 --- a/rest.js +++ b/rest.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define, process) { diff --git a/test/UrlBuilder-test.js b/test/UrlBuilder-test.js index b5a8046..10a24b9 100644 --- a/test/UrlBuilder-test.js +++ b/test/UrlBuilder-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define, location) { diff --git a/test/buster.js b/test/buster.js index 0f7f252..bf0700f 100644 --- a/test/buster.js +++ b/test/buster.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ var config = exports; diff --git a/test/client/jsonp-test-browser.js b/test/client/jsonp-test-browser.js index 35ae5ca..b29afae 100644 --- a/test/client/jsonp-test-browser.js +++ b/test/client/jsonp-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -46,7 +31,7 @@ assert.same(request, response.request); refute(request.canceled); refute(response.raw.parentNode); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the jsonp client from the jsonp interceptor by default': function (done) { var request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'html5' } }; @@ -55,7 +40,7 @@ assert.same(request, response.request); refute(request.canceled); refute(response.raw.parentNode); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should abort the request if canceled': function (done) { var request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'html5' } }; @@ -66,7 +51,7 @@ assert(request.canceled); refute(response.raw.parentNode); }) - ).always(done); + ).ensure(done); refute(request.canceled); request.cancel(); }, @@ -77,7 +62,7 @@ failOnThrow(function (response) { assert.same('loaderror', response.error); }) - ).always(done); + ).ensure(done); }, 'should not make a request that has already been canceled': function (done) { var request = { canceled: true, path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'javascript' } }; @@ -88,7 +73,7 @@ assert(request.canceled); assert.same('precanceled', response.error); }) - ).always(done); + ).ensure(done); }, 'should not be the default client': function () { refute.same(client, rest); diff --git a/test/client/node-test-node.js b/test/client/node-test-node.js index 94d7765..fa2c13c 100644 --- a/test/client/node-test-node.js +++ b/test/client/node-test-node.js @@ -1,36 +1,22 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; fail = buster.assertions.fail; failOnThrow = buster.assertions.failOnThrow; - define('rest/client/jsonp-test', function (require) { + define('rest/client/node-test', function (require) { var rest, client, http, server; @@ -78,7 +64,7 @@ assert.equals('text/plain', response.headers['Content-Type']); assert.equals(response.entity.length, parseInt(response.headers['Content-Length'], 10)); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit GET': function (done) { var request = { path: 'http://localhost:8080/', method: 'GET' }; @@ -88,7 +74,7 @@ assert.equals(response.entity, 'hello world'); assert.equals(response.status.code, 200); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make a POST with an entity': function (done) { var request = { path: 'http://localhost:8080/', entity: 'echo' }; @@ -100,7 +86,7 @@ assert.equals('text/plain', response.headers['Content-Type']); assert.equals(response.entity.length, parseInt(response.headers['Content-Length'], 10)); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit POST with an entity': function (done) { var request = { path: 'http://localhost:8080/', entity: 'echo', method: 'POST' }; @@ -109,7 +95,7 @@ assert.equals(response.request.method, 'POST'); assert.equals(response.entity, 'echo'); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should abort the request if canceled': function (done) { var request = { path: 'http://localhost:8080/' }; @@ -118,7 +104,7 @@ failOnThrow(function (/* response */) { assert(request.canceled); }) - ).always(done); + ).ensure(done); refute(request.canceled); request.cancel(); }, @@ -129,7 +115,7 @@ failOnThrow(function (response) { assert(response.error); }) - ).always(done); + ).ensure(done); }, 'should not make a request that has already been canceled': function (done) { var request = { canceled: true, path: 'http://localhost:1234' }; @@ -140,7 +126,7 @@ assert(request.canceled); assert.same('precanceled', response.error); }) - ).always(done); + ).ensure(done); }, 'should be the default client': function () { assert.same(client, rest); diff --git a/test/client/xdr-test-browser.js b/test/client/xdr-test-browser.js index 45034e7..8fb705a 100644 --- a/test/client/xdr-test-browser.js +++ b/test/client/xdr-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -50,7 +35,7 @@ assert.same(request, response.request); assert.equals(response.request.method, 'GET'); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit GET': function (done) { var request = { path: flickrUrl, method: 'GET' }; @@ -61,7 +46,7 @@ assert.equals(response.request.method, 'GET'); assert.equals(xdr.responseText, response.entity); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make a POST with an entity': function (done) { var request = { path: flickrUrl, entity: 'hello world' }; @@ -72,7 +57,7 @@ assert.equals(response.request.method, 'POST'); assert.equals(xdr.responseText, response.entity); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit POST with an entity': function (done) { var request = { path: flickrUrl, entity: 'hello world', method: 'POST' }; @@ -83,7 +68,7 @@ assert.equals(response.request.method, 'POST'); assert.equals(xdr.responseText, response.entity); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should abort the request if canceled': function (done) { // TDOO find an endpoint that takes a bit to respond, cached files may return synchronously @@ -93,7 +78,7 @@ failOnThrow(function (response) { assert(response.request.canceled); }) - ).always(done); + ).ensure(done); refute(request.canceled); request.cancel(); }, @@ -104,7 +89,7 @@ failOnThrow(function (response) { assert.same('loaderror', response.error); }) - ).always(done); + ).ensure(done); }, 'should not make a request that has already been canceled': function (done) { var request = { canceled: true, path: '/' }; @@ -115,7 +100,7 @@ assert(request.canceled); assert.same('precanceled', response.error); }) - ).always(done); + ).ensure(done); } }, 'should not be the default client': function () { diff --git a/test/client/xhr-test-browser.js b/test/client/xhr-test-browser.js index a7f969f..6ef8f77 100644 --- a/test/client/xhr-test-browser.js +++ b/test/client/xhr-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -58,7 +43,7 @@ assert.equals(xhr.getResponseHeader(name), response.headers[name]); } refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit GET': function (done) { var request = { path: '/', method: 'GET' }; @@ -75,7 +60,7 @@ assert.equals(xhr.getResponseHeader(name), response.headers[name]); } refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make a POST with an entity': function (done) { var request = { path: '/', entity: 'hello world' }; @@ -92,7 +77,7 @@ assert.equals(xhr.getResponseHeader(name), response.headers[name]); } refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should make an explicit POST with an entity': function (done) { var request = { path: '/', entity: 'hello world', method: 'POST' }; @@ -109,7 +94,7 @@ assert.equals(xhr.getResponseHeader(name), response.headers[name]); } refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should abort the request if canceled': function (done) { // TDOO find an endpoint that takes a bit to respond, cached files may return synchronously @@ -137,7 +122,7 @@ refute(request.canceled); request.cancel(); }) - ]).always(done); + ]).ensure(done); }, '//should propogate request errors': function (done) { // TODO follow up with Sauce Labs @@ -148,7 +133,7 @@ failOnThrow(function (response) { assert.same('loaderror', response.error); }) - ).always(done); + ).ensure(done); }, 'should not make a request that has already been canceled': function (done) { var request = { canceled: true, path: '/' }; @@ -159,7 +144,7 @@ assert(request.canceled); assert.same('precanceled', response.error); }) - ).always(done); + ).ensure(done); }, 'should reject if an XHR impl is not available': { requiresSupportFor: { 'no-xhr': !window.XMLHttpRequest }, @@ -171,7 +156,7 @@ assert.same(request, response.request); assert.same('xhr-not-available', response.error); }) - ).always(done); + ).ensure(done); } }, 'should be the default client': function () { diff --git a/test/curl-config.js b/test/curl-config.js index c2bb19a..e50ac01 100644 --- a/test/curl-config.js +++ b/test/curl-config.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (global) { diff --git a/test/dojo/RestStore-test-browser.js b/test/dojo/RestStore-test-browser.js index a76397e..64c2a36 100644 --- a/test/dojo/RestStore-test-browser.js +++ b/test/dojo/RestStore-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -58,21 +43,21 @@ var store = new RestStore({ client: client }); store.query({ q: 'what is the meaning of life?' }).then(function (response) { assert.equals('what is the meaning of life?', response.request.params.q); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should get based on the id': function (done) { var store = new RestStore({ client: client }); store.get(42).then(function (response) { assert.equals('42', response.request.path); refute(response.request.method); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should remove based on the id': function (done) { var store = new RestStore({ client: client }); store.remove(42).then(function (response) { assert.equals('42', response.request.path); assert.equals('delete', response.request.method); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should add a record without an ID': function (done) { var store = new RestStore({ client: client }); @@ -81,7 +66,7 @@ assert.equals('post', response.request.method); assert.equals('*', response.request.headers['If-None-Match']); assert.equals('bar', response.request.entity.foo); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should add a record with an explicit ID': function (done) { var store = new RestStore({ client: client }); @@ -91,7 +76,7 @@ assert.equals('*', response.request.headers['If-None-Match']); assert.equals('bar', response.request.entity.foo); refute.equals('42', response.request.entity.id); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should add a record with an implicit ID': function (done) { var store = new RestStore({ client: client }); @@ -101,7 +86,7 @@ assert.equals('*', response.request.headers['If-None-Match']); assert.equals('bar', response.request.entity.foo); assert.equals('42', response.request.entity.id); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should add a record ignoring the ID': function (done) { var store = new RestStore({ client: client, ignoreId: true }); @@ -111,7 +96,7 @@ assert.equals('*', response.request.headers['If-None-Match']); assert.equals('bar', response.request.entity.foo); assert.equals('42', response.request.entity.id); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should put overwriting target': function (done) { var store = new RestStore({ client: client }); @@ -119,7 +104,7 @@ assert.equals('42', response.request.path); assert.equals('put', response.request.method); assert.equals('*', response.request.headers['If-Match']); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should put without overwriting target': function (done) { var store = new RestStore({ client: client }); @@ -127,7 +112,7 @@ assert.equals('42', response.request.path); assert.equals('put', response.request.method); assert.equals('*', response.request.headers['If-None-Match']); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should put with default config': function (done) { var store = new RestStore({ client: client }); @@ -136,7 +121,7 @@ assert.equals('put', response.request.method); refute(response.request.headers['If-None-Match']); refute(response.request.headers['If-Match']); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have a proper prototype chain': function () { assert(new RestStore() instanceof RestStore); diff --git a/test/dojo/wire-test-browser.js b/test/dojo/wire-test-browser.js index 78e562e..9ae68f1 100644 --- a/test/dojo/wire-test-browser.js +++ b/test/dojo/wire-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -58,7 +43,7 @@ }; wire(spec).then(function (spec) { assert(spec.store instanceof RestStore); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should get with resource! waiting for data': function (done) { var spec; @@ -69,7 +54,7 @@ wire(spec).then(function (spec) { assert.equals('bar', spec.resource.entity.foo); assert.equals('test/dojo/hello.json', spec.resource.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should support client!': function (done) { var spec; @@ -81,7 +66,7 @@ return spec.client({}).then(function (response) { assert.equals('bar', response.foo); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }); diff --git a/test/failOnThrow.js b/test/failOnThrow.js index 5ab0dd6..751c2e4 100644 --- a/test/failOnThrow.js +++ b/test/failOnThrow.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster) { diff --git a/test/interceptor-test.js b/test/interceptor-test.js index 4f181bf..109941e 100644 --- a/test/interceptor-test.js +++ b/test/interceptor-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { @@ -64,7 +49,7 @@ client().then(function (response) { assert.same('default', response.id); assert.same(client, response.request.originator); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the client configured into the interceptor by default': function (done) { var theInterceptor, client; @@ -75,7 +60,7 @@ client().then(function (response) { assert.same('default', response.id); assert.same(client, response.request.originator); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should override the client configured into the interceptor by default': function (done) { var theInterceptor, client; @@ -86,7 +71,7 @@ client().then(function (response) { assert.same('other', response.id); assert.same(client, response.request.originator); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the request phase': function (done) { var theInterceptor, client; @@ -99,7 +84,7 @@ client = theInterceptor(defaultClient); client().then(function (response) { assert.same('request', response.request.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the request phase and handle a promise': function (done) { var theInterceptor, client; @@ -115,7 +100,7 @@ client().then(function (response) { assert.same('default', response.id); assert.same('request', response.request.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the request phase and handle a rejected promise': function (done) { var theInterceptor, client; @@ -134,7 +119,7 @@ assert.same('request', response.request.phase); assert.same('rejected request', response.error); }) - ).always(done); + ).ensure(done); }, 'should intercept the response phase': function (done) { var theInterceptor, client; @@ -147,7 +132,7 @@ client = theInterceptor(defaultClient); client().then(function (response) { assert.same('response', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the response phase and handle a promise': function (done) { var theInterceptor, client; @@ -162,7 +147,7 @@ client = theInterceptor(defaultClient); client().then(function (response) { assert.same('response', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the response phase and handle a rejceted promise': function (done) { var theInterceptor, client; @@ -178,7 +163,7 @@ failOnThrow(function (response) { assert.same('response', response.phase); }) - ).always(done); + ).ensure(done); }, 'should intercept the response phase for an error': function (done) { var theInterceptor, client; @@ -194,7 +179,7 @@ failOnThrow(function (response) { assert.same('response', response.phase); }) - ).always(done); + ).ensure(done); }, 'should intercept the response phase for an error and handle a promise maintaining the error': function (done) { var theInterceptor, client; @@ -210,7 +195,7 @@ failOnThrow(function (response) { assert.same('response', response.phase); }) - ).always(done); + ).ensure(done); }, 'should intercept the response phase for an error and handle a rejected promise maintaining the error': function (done) { var theInterceptor, client; @@ -226,7 +211,7 @@ failOnThrow(function (response) { assert.same('response', response.phase); }) - ).always(done); + ).ensure(done); }, 'should intercept the success phase': function (done) { var theInterceptor, client; @@ -240,7 +225,7 @@ client = theInterceptor(defaultClient); client().then(function (response) { assert.same('success', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the success phase and handle a promise': function (done) { var theInterceptor, client; @@ -256,7 +241,7 @@ client = theInterceptor(defaultClient); client().then(function (response) { assert.same('success', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the success phase and handle a rejceted promise': function (done) { var theInterceptor, client; @@ -273,7 +258,7 @@ failOnThrow(function (response) { assert.same('success', response.phase); }) - ).always(done); + ).ensure(done); }, 'should intercept the error phase': function (done) { var theInterceptor, client; @@ -287,7 +272,7 @@ client = theInterceptor(errorClient); client().then(function (response) { assert.same('error', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the error phase and handle a promise': function (done) { var theInterceptor, client; @@ -301,7 +286,7 @@ client = theInterceptor(errorClient); client().then(function (response) { assert.same('error', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should intercept the error phase and handle a rejceted promise': function (done) { var theInterceptor, client; @@ -318,7 +303,7 @@ failOnThrow(function (response) { assert.same('error', response.phase); }) - ).always(done); + ).ensure(done); }, 'should pass interceptor config to handlers': function (done) { var theInterceptor, client, theConfig; @@ -341,7 +326,7 @@ client().then(function (response) { assert.same('request', response.request.phase); assert.same('response', response.phase); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should share context between handlers that is unique per request': function (done) { var theInterceptor, client, count, counted; @@ -368,7 +353,7 @@ assert(counted.indexOf(2) === -1); assert(counted.indexOf(undef) >= 0); assert(counted.indexOf(3) >= 0); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the client provided by a ComplexRequest': function (done) { var theInterceptor, client; @@ -384,7 +369,7 @@ client().then(function (response) { assert.same('default', response.id); assert.same(client, response.request.originator); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the repsponse provided by a ComplexRequest': function (done) { var theInterceptor, client; @@ -399,7 +384,7 @@ client().then(function (response) { assert.same('complex-response', response.id); assert.same(client, response.request.originator); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should cancel requests with the abort trigger provided by a ComplexRequest': function (done) { var theInterceptor, client; @@ -419,7 +404,7 @@ assert.same('abort', response.id); assert.same('unresponsive', response.request.id); }) - ).always(done); + ).ensure(done); }, 'should have access to the client in the response handlers for subsequent requests': function (done) { var theInterceptor, client; @@ -433,7 +418,7 @@ client().then(function (response) { assert.same(client, response.client); assert.same('default', response.id); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should initialize the config object, without modifying the provided object': function (done) { var theConfig, theInterceptor, client; @@ -465,7 +450,7 @@ assert.same('request', response.request.phase); assert.same('response', response.phase); assert.same('default', response.id); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { var theInterceptor = interceptor(); diff --git a/test/interceptor/basicAuth-test.js b/test/interceptor/basicAuth-test.js index 5c73693..60015e3 100644 --- a/test/interceptor/basicAuth-test.js +++ b/test/interceptor/basicAuth-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -44,7 +29,7 @@ ); client({}).then(function (response) { assert.equals('Basic dXNlcjpwYXNz', response.request.headers.Authorization); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should authenticate the requst from the request': function (done) { var client = basicAuth( @@ -52,7 +37,7 @@ ); client({ username: 'user', password: 'pass'}).then(function (response) { assert.equals('Basic dXNlcjpwYXNz', response.request.headers.Authorization); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not authenticate without a username': function (done) { var client = basicAuth( @@ -60,7 +45,7 @@ ); client({}).then(function (response) { refute.defined(response.request.headers.Authorization); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, basicAuth().skip()); diff --git a/test/interceptor/defaultRequest-test.js b/test/interceptor/defaultRequest-test.js index bb2252b..9f2282c 100644 --- a/test/interceptor/defaultRequest-test.js +++ b/test/interceptor/defaultRequest-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2013-2013 VMware, Inc. All Rights Reserved. + * Copyright 2013-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -47,38 +32,38 @@ assert.same(client, response.request.originator); delete response.request.originator; assert.equals({}, response.request); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should default the method': function (done) { var client = defaultRequest(defaultClient, { method: 'PUT' }); client({}).then(function (response) { assert.equals('PUT', response.request.method); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not overwrite the method': function (done) { var client = defaultRequest(defaultClient, { method: 'PUT' }); client({ method: 'GET' }).then(function (response) { assert.equals('GET', response.request.method); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should default the path': function (done) { var client = defaultRequest(defaultClient, { path: '/foo' }); client({}).then(function (response) { assert.equals('/foo', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not overwrite the path': function (done) { var client = defaultRequest(defaultClient, { path: '/foo' }); client({ path: '/bar' }).then(function (response) { assert.equals('/bar', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should default params': function (done) { var client = defaultRequest(defaultClient, { params: { foo: 'bar', bool: 'false' } }); client({}).then(function (response) { assert.equals('bar', response.request.params.foo); assert.equals('false', response.request.params.bool); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should merge params': function (done) { var client = defaultRequest(defaultClient, { params: { foo: 'bar', bool: 'false' } }); @@ -86,14 +71,14 @@ assert.equals('bar', response.request.params.foo); assert.equals('true', response.request.params.bool); assert.equals('bloop', response.request.params.bleep); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should default headers': function (done) { var client = defaultRequest(defaultClient, { headers: { foo: 'bar', bool: 'false' } }); client({}).then(function (response) { assert.equals('bar', response.request.headers.foo); assert.equals('false', response.request.headers.bool); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should merge headers': function (done) { var client = defaultRequest(defaultClient, { headers: { foo: 'bar', bool: 'false' } }); @@ -101,19 +86,19 @@ assert.equals('bar', response.request.headers.foo); assert.equals('true', response.request.headers.bool); assert.equals('bloop', response.request.headers.bleep); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should default the entity': function (done) { var client = defaultRequest(defaultClient, { entity: Math }); client({}).then(function (response) { assert.same(Math, response.request.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not overwrite the entity': function (done) { var client = defaultRequest(defaultClient, { entity: Math }); client({ entity: Date }).then(function (response) { assert.same(Date, response.request.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, defaultRequest().skip()); diff --git a/test/interceptor/entity-test.js b/test/interceptor/entity-test.js index 07b7811..27eab01 100644 --- a/test/interceptor/entity-test.js +++ b/test/interceptor/entity-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -45,7 +30,7 @@ client().then(function (response) { assert.same(body, response); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should return the whole response if there is no entity': function (done) { var client, response; @@ -55,7 +40,7 @@ client().then(function (r) { assert.same(response, r); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, entity().skip()); diff --git a/test/interceptor/errorCode-test.js b/test/interceptor/errorCode-test.js index c6069b4..9b74f20 100644 --- a/test/interceptor/errorCode-test.js +++ b/test/interceptor/errorCode-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -44,7 +29,7 @@ ); client({}).then(function (response) { assert.equals(399, response.status.code); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should reject for 400 or greater by default': function (done) { var client = errorCode( @@ -55,7 +40,7 @@ failOnThrow(function (response) { assert.equals(400, response.status.code); }) - ).always(done); + ).ensure(done); }, 'should reject lower then 400 with a custom code': function (done) { var client = errorCode( @@ -67,7 +52,7 @@ failOnThrow(function (response) { assert.equals(300, response.status.code); }) - ).always(done); + ).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, errorCode().skip()); diff --git a/test/interceptor/hateoas-test.js b/test/interceptor/hateoas-test.js index 3d0bb69..4592ac3 100644 --- a/test/interceptor/hateoas-test.js +++ b/test/interceptor/hateoas-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -75,7 +60,7 @@ client().then(function (response) { assert.same(parent, response.entity._links.parentLink); assert.same(self, response.entity._links.selfLink); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should parse links in the entity into the entity': function (done) { var client, body, parent, self; @@ -89,7 +74,7 @@ client().then(function (response) { assert.same(parent, response.entity.parentLink); assert.same(self, response.entity.selfLink); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should create a client for the related resource': function (done) { var client, body, parent, self; @@ -105,7 +90,7 @@ return parentClient().then(function (response) { assert.same(parent.href, response.request.path); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should fetch a related resource': { requiresSupportFor: { 'ES5 getters': supports['ES5 getters'] }, @@ -126,7 +111,7 @@ assert.same('/resource', response.request.path); assert.same('/resource', response.entity._links.selfLink.href); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'should have the default client as the parent by default': function () { diff --git a/test/interceptor/ie/xdomain-test-browser.js b/test/interceptor/ie/xdomain-test-browser.js index e858f15..78f1e0d 100644 --- a/test/interceptor/ie/xdomain-test-browser.js +++ b/test/interceptor/ie/xdomain-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -55,17 +40,17 @@ 'should use the XDomainRequest engine for cross domain requests': function (done) { client({ path: 'http://example.com' }).then(function (response) { assert.same('xdr', response.client); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the standard engine for same domain requests, with absolute paths': function (done) { client({ path: window.location.toString() }).then(function (response) { assert.same('default', response.client); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the standard engine for same domain requests, with relative paths': function (done) { client({ path: '/' }).then(function (response) { assert.same('default', response.client); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'for non-XDomainRequest enabled browsers': { @@ -73,7 +58,7 @@ 'should always use the standard engine': function (done) { client({ path: 'http://example.com' }).then(function (response) { assert.same('default', response.client); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'should have the default client as the parent by default': function () { diff --git a/test/interceptor/ie/xhr-test-browser.js b/test/interceptor/ie/xhr-test-browser.js index 6e3d1be..2d4db83 100644 --- a/test/interceptor/ie/xhr-test-browser.js +++ b/test/interceptor/ie/xhr-test-browser.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2013 VMware, Inc. All Rights Reserved. + * Copyright 2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -48,7 +33,7 @@ var client = xhr(defaultClient); client({}).then(function (response) { assert.same(XMLHttpRequest, response.request.engine); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'should fall back to an ActiveX XHR-like object as the engine': { @@ -59,7 +44,7 @@ client({}).then(function (response) { refute.same(XMLHttpRequest, response.request.engine); assert.same('function', typeof response.request.engine); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'should have the default client as the parent by default': function () { diff --git a/test/interceptor/jsonp-test.js b/test/interceptor/jsonp-test.js index 5311afb..0401e8b 100644 --- a/test/interceptor/jsonp-test.js +++ b/test/interceptor/jsonp-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -47,7 +32,7 @@ client({}).then(function (response) { assert.equals('callback', response.request.callback.param); assert.equals('jsonp', response.request.callback.prefix); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should include callback info from request overridding config values': function (done) { var client = jsonp( @@ -57,7 +42,7 @@ client({ callback: { param: 'customCallback', prefix: 'customPrefix' } }).then(function (response) { assert.equals('customCallback', response.request.callback.param); assert.equals('customPrefix', response.request.callback.prefix); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the jsonp client as the parent by default': function () { refute.same(rest, jsonp().skip()); diff --git a/test/interceptor/location-test.js b/test/interceptor/location-test.js index 09c6202..882059a 100644 --- a/test/interceptor/location-test.js +++ b/test/interceptor/location-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -57,7 +42,7 @@ assert.same(spy.args[2][0].path, '/foo/2'); assert.same(spy.args[2][0].method, 'GET'); refute(spy.returnValues[2].headers.Location); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should return the response if there is no location header': function (done) { var client, spy; @@ -66,7 +51,7 @@ client({}).then(function (response) { assert.equals(200, response.status.code); assert.same(1, spy.callCount); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, location().skip()); diff --git a/test/interceptor/mime-test.js b/test/interceptor/mime-test.js index d58f7bb..4adc20e 100644 --- a/test/interceptor/mime-test.js +++ b/test/interceptor/mime-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -48,7 +33,7 @@ client({}).then(function (response) { assert.equals({}, response.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should encode the request entity': function (done) { var client; @@ -62,7 +47,7 @@ client({ entity: {} }).then(function (response) { assert.equals('{}', response.request.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should encode the request entity from the Content-Type of the request, ignoring the filter config': function (done) { var client; @@ -78,7 +63,7 @@ assert.equals('{}', response.request.entity); assert.equals('application/json', response.request.headers['Content-Type']); assert.equals(0, response.request.headers.Accept.indexOf('application/json')); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not overwrite the requests Accept header': function (done) { var client; @@ -94,7 +79,7 @@ assert.equals('{}', response.request.entity); assert.equals('application/json', response.request.headers['Content-Type']); assert.equals('foo', response.request.headers.Accept); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should error the request if unable to find a converter for the desired mime': function (done) { var client, request; @@ -108,7 +93,7 @@ assert.same('unknown-mime', response.error); assert.same(request, response.request); }) - ).always(done); + ).ensure(done); }, 'should use text/plain converter for a response if unable to find a converter for the desired mime': function (done) { var client; @@ -119,7 +104,7 @@ client({}).then(function (response) { assert.same('{}', response.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the configured mime registry': function (done) { var client, customRegistry; @@ -146,7 +131,7 @@ assert.equals('write: request entity', response.request.entity); assert.equals('application/vnd.com.example', response.headers['Content-Type']); assert.equals('read: response entity', response.entity); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, mime().skip()); diff --git a/test/interceptor/oAuth-test.js b/test/interceptor/oAuth-test.js index f11d380..e437ab3 100644 --- a/test/interceptor/oAuth-test.js +++ b/test/interceptor/oAuth-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define, global) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -48,7 +33,7 @@ client({}).then(function (response) { assert.equals('bearer abcxyz', response.request.headers.Authorization); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use implicit flow to authenticate the request': function (done) { var client, windowStrategy, windowStrategyClose, oAuthCallbackName; @@ -82,7 +67,7 @@ client({}).then(function (response) { assert.equals('bearer abcxyz', response.request.headers.Authorization); assert.called(windowStrategyClose); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, oAuth({ token: 'bearer abcxyz' }).skip()); diff --git a/test/interceptor/pathPrefix-test.js b/test/interceptor/pathPrefix-test.js index 86aaf8c..638a82d 100644 --- a/test/interceptor/pathPrefix-test.js +++ b/test/interceptor/pathPrefix-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -44,7 +29,7 @@ ); client({ path: '/bar' }).then(function (response) { assert.equals('/foo/bar', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should prepend prefix before path, adding slash between path segments': function (done) { var client = pathPrefix( @@ -53,7 +38,7 @@ ); client({ path: 'bar' }).then(function (response) { assert.equals('/foo/bar', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should prepend prefix before path, not adding extra slash between path segments': function (done) { var client = pathPrefix( @@ -62,7 +47,7 @@ ); client({ path: 'bar' }).then(function (response) { assert.equals('/foo/bar', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not prepend prefix before a fully qualified path': function (done) { var client = pathPrefix( @@ -71,7 +56,7 @@ ); client({ path: 'http://www.example.com/' }).then(function (response) { assert.equals('http://www.example.com/', response.request.path); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should have the default client as the parent by default': function () { assert.same(rest, pathPrefix().skip()); diff --git a/test/interceptor/retry-test.js b/test/interceptor/retry-test.js index f23bccd..2f4fda9 100644 --- a/test/interceptor/retry-test.js +++ b/test/interceptor/retry-test.js @@ -1,29 +1,15 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, fail, failOnThrow, undef; + var assert, fail, failOnThrow; assert = buster.assertions.assert; fail = buster.assertions.fail; @@ -56,7 +42,7 @@ ); client({}).then(function (response) { assert.equals(200, response.status.code); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should accept custom config': { setUp: function () { @@ -90,7 +76,7 @@ assert.equals(200, response.status.code); assert.equals(count, 4); assert.equals(50, new Date().getTime() - start); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }, 'should not make propagate request if marked as canceled': function (done) { @@ -109,7 +95,7 @@ assert.equals('precanceled', response.error); assert.same(1, parent.callCount); }) - ).always(done); + ).ensure(done); request.canceled = true; }, diff --git a/test/interceptor/timeout-test.js b/test/interceptor/timeout-test.js index 88c52c7..45f5a00 100644 --- a/test/interceptor/timeout-test.js +++ b/test/interceptor/timeout-test.js @@ -1,29 +1,15 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Jeremy Grelle + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -79,7 +65,7 @@ // delay to make sure timeout has fired, but not rejected the response refute(request.canceled); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should resolve if client responds before timeout': function (done) { var client, request; @@ -89,7 +75,7 @@ assert.same(request, response.request); refute(response.error); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should reject even if client responds after timeout': function (done) { var client, request; @@ -102,7 +88,7 @@ assert.equals('timeout', response.error); assert(request.canceled); }) - ).always(done); + ).ensure(done); }, 'should reject if client hanges': function (done) { var client, request; @@ -115,7 +101,7 @@ assert.equals('timeout', response.error); assert(request.canceled); }) - ).always(done); + ).ensure(done); }, 'should use request timeout value in perference to interceptor value': function (done) { var client, request; @@ -125,7 +111,7 @@ assert.same(request, response.request); refute(response.error); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not reject without a configured timeout value': function (done) { var client, request; @@ -135,7 +121,7 @@ assert.same(request, response.request); refute(response.error); refute(request.canceled); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should cancel request if client support cancelation': function (done) { var client, request; @@ -148,7 +134,7 @@ assert.equals('timeout', response.error); assert(request.canceled); }) - ).always(done); + ).ensure(done); refute(request.canceled); }, 'should have the default client as the parent by default': function () { diff --git a/test/mime/registry-test.js b/test/mime/registry-test.js index a8f9a8f..2455504 100644 --- a/test/mime/registry-test.js +++ b/test/mime/registry-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, undef; + var assert, refute, fail; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -44,14 +29,14 @@ registry.lookup('text/plain').then(function (converter) { assert.isFunction(converter.read); assert.isFunction(converter.write); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should return registed converter': function (done) { var converter = {}; registry.register('application/vnd.com.example', converter); registry.lookup('application/vnd.com.example').then(function (c) { assert.same(converter, c); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should reject for non-existant converter': function (done) { registry.lookup('application/bogus').then( @@ -59,7 +44,7 @@ function () { assert(true); } - ).always(done); + ).ensure(done); }, 'should resolve converters from parent registries': function (done) { var child, converter; @@ -68,7 +53,7 @@ registry.register('application/vnd.com.example', converter); child.lookup('application/vnd.com.example').then(function (c) { assert.same(converter, c); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should override parent registries when registering in a child': function (done) { var child, converterParent, converterChild; @@ -79,7 +64,7 @@ child.register('application/vnd.com.example', converterChild); child.lookup('application/vnd.com.example').then(function (c) { assert.same(converterChild, c); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should not have any side effects in a parent registry from a child': function (done) { var child, converterParent, converterChild; @@ -90,7 +75,7 @@ child.register('application/vnd.com.example', converterChild); registry.lookup('application/vnd.com.example').then(function (c) { assert.same(converterParent, c); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } }); diff --git a/test/mime/type/application/json-test.js b/test/mime/type/application/json-test.js index 9376522..7a37f9c 100644 --- a/test/mime/type/application/json-test.js +++ b/test/mime/type/application/json-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/mime/type/application/x-www-form-urlencoded-test.js b/test/mime/type/application/x-www-form-urlencoded-test.js index 1b4bd41..bdffcaa 100644 --- a/test/mime/type/application/x-www-form-urlencoded-test.js +++ b/test/mime/type/application/x-www-form-urlencoded-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/mime/type/text/plain-test.js b/test/mime/type/text/plain-test.js index 02562c4..6ed4da0 100644 --- a/test/mime/type/text/plain-test.js +++ b/test/mime/type/text/plain-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/run.js b/test/run.js index 5e5a46d..d28787f 100644 --- a/test/run.js +++ b/test/run.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/util/base64-test.js b/test/util/base64-test.js index 77d2626..87cf884 100644 --- a/test/util/base64-test.js +++ b/test/util/base64-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/util/beget-test.js b/test/util/beget-test.js index f6a891c..b4c3d97 100644 --- a/test/util/beget-test.js +++ b/test/util/beget-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/util/mixin-test.js b/test/util/mixin-test.js index 6a8264b..4d16da8 100644 --- a/test/util/mixin-test.js +++ b/test/util/mixin-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/util/normalizeHeaderName-test.js b/test/util/normalizeHeaderName-test.js index 4b03305..9f1004b 100644 --- a/test/util/normalizeHeaderName-test.js +++ b/test/util/normalizeHeaderName-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/util/pubsub-test.js b/test/util/pubsub-test.js index 0740976..2eb89d7 100644 --- a/test/util/pubsub-test.js +++ b/test/util/pubsub-test.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/version-test-node.js b/test/version-test-node.js index d9f2425..d764c67 100644 --- a/test/version-test-node.js +++ b/test/version-test-node.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { diff --git a/test/wire-test.js b/test/wire-test.js index 61c03a4..32bb70c 100644 --- a/test/wire-test.js +++ b/test/wire-test.js @@ -1,29 +1,14 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (buster, define) { 'use strict'; - var assert, refute, fail, failOnThrow, undef; + var assert, refute, fail, failOnThrow; assert = buster.assertions.assert; refute = buster.assertions.refute; @@ -52,7 +37,7 @@ return spec.client({}).then(function (response) { assert.equals('bar', response.foo); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use client! config with entity interceptor disabled': function (done) { var spec, client; @@ -69,7 +54,7 @@ assert.equals('text/plain', response.request.headers.Accept); assert.equals('bar', response.entity.foo); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should be rejected for a server error status code': function (done) { var spec, client; @@ -90,7 +75,7 @@ ); }, fail - ).always(done); + ).ensure(done); }, 'should ignore status code when errorCode interceptor is disabled': function (done) { var spec, client; @@ -105,7 +90,7 @@ return spec.client({}).then(function (response) { assert.equals('bar', response.foo); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should ignore Content-Type and entity when mime interceptor is disabled': function (done) { var spec, client; @@ -120,7 +105,7 @@ return spec.client({}).then(function (response) { assert.isString(response); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use x-www-form-urlencoded as the default Content-Type for POSTs': function (done) { var spec, client; @@ -137,7 +122,7 @@ assert.equals(0, response.request.headers.Accept.indexOf('application/x-www-form-urlencoded')); assert.equals('application/x-www-form-urlencoded', response.request.headers['Content-Type']); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'should use the rest factory': { '': function (done) { @@ -167,7 +152,7 @@ assert.equals(0, response.request.headers.Accept.indexOf('application/json')); assert.equals('application/json', response.request.headers['Content-Type']); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'with interceptor references': function (done) { var spec, client; @@ -199,7 +184,7 @@ assert.equals(0, response.request.headers.Accept.indexOf('application/json')); assert.equals('application/json', response.request.headers['Content-Type']); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'with interceptor string shortcuts': function (done) { var spec, client; @@ -219,7 +204,7 @@ }; wire(spec, { require: require }).then(function (spec) { assert.same(client, spec.client.skip().skip().skip()); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'with concrete interceptors': function (done) { var spec, client; @@ -242,7 +227,7 @@ spec.client().then(function (response) { assert.equals('thePrefix', response.request.path); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'using the default client': function (done) { var spec; @@ -256,7 +241,7 @@ }; wire(spec, { require: require }).then(function (spec) { assert.same(rest, spec.client.skip()); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'using a referenced parent client': function (done) { var spec, client; @@ -277,7 +262,7 @@ }; wire(spec, { require: require }).then(function (spec) { assert.same(client, spec.client.skip()); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); }, 'without wiring interceptor configurations': function (done) { var spec, client; @@ -303,7 +288,7 @@ spec.client().then(function (response) { assert.equals('useThisOne', response.request.path); }); - }).then(undef, fail).always(done); + }).otherwise(fail).ensure(done); } } }); diff --git a/util/base64.js b/util/base64.js index 21cdb2e..837161a 100644 --- a/util/base64.js +++ b/util/base64.js @@ -1,5 +1,4 @@ /* - * Base 64 implementation in JavaScript * Copyright (c) 2009 Nicholas C. Zakas. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,6 +21,7 @@ */ /* + * Base 64 implementation in JavaScript * Original source available at https://raw.github.com/nzakas/computer-science-in-javascript/02a2745b4aa8214f2cae1bf0b15b447ca1a91b23/encodings/base64/base64.js * * Converted to AMD and linter refinement by Scott Andrews diff --git a/util/beget.js b/util/beget.js index e0acaa3..d7e6399 100644 --- a/util/beget.js +++ b/util/beget.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/util/mixin.js b/util/mixin.js index 18e2b3f..6bf5588 100644 --- a/util/mixin.js +++ b/util/mixin.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012-2013 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/util/normalizeHeaderName.js b/util/normalizeHeaderName.js index 692997e..edacf16 100644 --- a/util/normalizeHeaderName.js +++ b/util/normalizeHeaderName.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/util/pubsub.js b/util/pubsub.js index d2b1321..b8a2793 100644 --- a/util/pubsub.js +++ b/util/pubsub.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) { diff --git a/wire.js b/wire.js index fdab408..bc00631 100644 --- a/wire.js +++ b/wire.js @@ -1,23 +1,8 @@ /* - * Copyright (c) 2012 VMware, Inc. All Rights Reserved. + * Copyright 2012-2013 the original author or authors + * @license MIT, see LICENSE.txt for details * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * @author Scott Andrews */ (function (define) {