Skip to content

Commit 99f0024

Browse files
committed
expose ApiKeyAuthorization and fix readme example
1 parent 06a4038 commit 99f0024

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
This is the Wordnik Swagger javascript client for use with [swagger](http://swagger.wordnik.com) enabled APIs.
22
It's written in CoffeeScript and tested with Jasmine, and is the fastest way to enable a javascript client to communicate with a swagger-enabled server.
33

4-
Find out more about the swagger project at [swagger.wordnik.com](http://swagger.wordnik.com),
4+
Find out more about the swagger project at [swagger.wordnik.com](http://swagger.wordnik.com),
55
and follow us on Twitter at [@swagger_doc](https://twitter.com/#!/swagger_doc).
66

77
## READ MORE about swagger!
@@ -61,13 +61,13 @@ That's it! You'll get a JSON response with the default callback handler:
6161
Need to pass an API key? Configure one as a querystring:
6262

6363
```js
64-
client.authorizations.add("apiKey", new swagger.ApiKeyAuthorization("api_key","special-key","query"));
64+
client.authorizations.add("apiKey", new client.ApiKeyAuthorization("api_key","special-key","query"));
6565
```
6666

6767
...or with a header:
6868

6969
```js
70-
client.authorizations.add("apiKey", new swagger.ApiKeyAuthorization("api_key","special-key","header"));
70+
client.authorizations.add("apiKey", new client.ApiKeyAuthorization("api_key","special-key","header"));
7171
```
7272

7373
### Calling an API with swagger + the browser!
@@ -129,11 +129,11 @@ The HTTP requests themselves are handled by the excellent [shred](https://github
129129
Development
130130
-----------
131131

132-
Please [fork the code](https://github.com/wordnik/swagger-js) and help us improve
132+
Please [fork the code](https://github.com/wordnik/swagger-js) and help us improve
133133
swagger.js. Send us a pull request and **we'll mail you a wordnik T-shirt!**
134134

135-
Swagger.js is written in CoffeeScript, so you'll need Node.js and the
136-
CoffeeScript compiler. For more detailed installation instructions, see
135+
Swagger.js is written in CoffeeScript, so you'll need Node.js and the
136+
CoffeeScript compiler. For more detailed installation instructions, see
137137
[coffeescript.org/#installation](http://coffeescript.org/#installation).
138138

139139
```bash
@@ -161,7 +161,7 @@ Copyright 2011-2013 Wordnik, Inc.
161161

162162
Licensed under the Apache License, Version 2.0 (the "License");
163163
you may not use this file except in compliance with the License.
164-
You may obtain a copy of the License at
164+
You may obtain a copy of the License at
165165
[apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
166166

167167
Unless required by applicable law or agreed to in writing, software

lib/swagger.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
12711271
if (obj.url.indexOf('?') > 0)
12721272
obj.url = obj.url + "&" + this.name + "=" + this.value;
12731273
else
1274-
obj.url = obj.url + "?" + this.name + "=" + this.value;
1274+
obj.url = obj.url + "?" + this.name + "=" + this.value;
12751275
return true;
12761276
} else if (this.type === "header") {
12771277
obj.headers[this.name] = this.value;
@@ -1304,6 +1304,7 @@ var e = (typeof window !== 'undefined' ? window : exports);
13041304
e.SwaggerHttp = SwaggerHttp;
13051305
e.SwaggerRequest = SwaggerRequest;
13061306
e.authorizations = new SwaggerAuthorizations();
1307+
e.ApiKeyAuthorization = ApiKeyAuthorization;
13071308
e.JQueryHttpClient = JQueryHttpClient;
13081309
e.ShredHttpClient = ShredHttpClient;
13091310
e.SwaggerOperation = SwaggerOperation;

0 commit comments

Comments
 (0)