Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Parameters are not sent in the Request(Swagger UI) #191

Closed
balaji410 opened this issue Apr 19, 2013 · 2 comments
Closed

Header Parameters are not sent in the Request(Swagger UI) #191

balaji410 opened this issue Apr 19, 2013 · 2 comments

Comments

@balaji410
Copy link

Hi,
I downloaded swagger (1.1.7) from GitHub
And I have added below mentioned changes in Index.html to pass headers parameters in the Request.
supportHeaderParams:true,
headers: { "Authorization": "XXXX", "someOtherHeader": "YYYY" },
$(function () {
window.swaggerUi = new SwaggerUi({
discoveryUrl:"http://petstore.swagger.wordnik.com/api/api-docs.json",
apiKey:"Authorization",
dom_id:"swagger-ui-container",
supportHeaderParams:true,
apiKeyName: "Authorization",
headers: { "Authorization": "XXXX", "someOtherHeader": "YYYY" },
supportedSubmitMethods: ['get', 'post', 'put'],
onComplete: function(swaggerApi, swaggerUi){
if(console) {
console.log("Loaded SwaggerUI")
console.log(swaggerApi);
console.log(swaggerUi);
}
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
},
onFailure: function(data) {
if(console) {
console.log("Unable to Load SwaggerUI");
console.log(data);
}
},
docExpansion: "none"
});

        window.swaggerUi.load();
    });

But header parameters are not sent with the request the below mentioned is my request and response headers.
Request Headers
Accept application/json, text/javascript, /; q=0.01
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection keep-alive
Host localhost:8080
Origin null
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101
Firefox/7.0.1
Response Headers
Access-Control-Allow-Head... Content-Type,Authorization
Access-Control-Allow-Meth... GET, POST, DELETE, PUT
Access-Control-Allow-Orig... *
Access-Control-Request-He... Authorization
Content-Length 187
Content-Type application/json
Date Fri, 19 Apr 2013 05:42:35 GMT
Server Apache-Coyote/1.1
Please help me in resolving the issue?

@fehguy
Copy link
Contributor

fehguy commented Jul 7, 2013

in 2.0-develop, there is a new model for sending headers and authorization tokens. Please take a look at the 2.0-develop branch in the index.html:

window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));

This allows you to add custom signing code into any request, including reading the resource listing. This will be used for oauth support as well.

@fehguy fehguy closed this as completed Jul 7, 2013
@fehguy
Copy link
Contributor

fehguy commented Jul 16, 2013

Hi, just responded in #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants