Skip to content

Commit c01871e

Browse files
committed
Fix request tab info on try-it when using oAuth 2.0
1 parent ce90a37 commit c01871e

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
88
</head>
99
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10-
<raml-console single-view src="https://qa.anypoint.mulesoft.com/apiplatform/repository/public/organizations/121/apis/2951/versions/3337/files/root"></raml-console>
10+
<raml-initializer></raml-initializer>
1111
<script src="scripts/api-console-vendor.js"></script>
1212
<script src="scripts/api-console.js"></script>
1313
<script>

dist/scripts/api-console-vendor.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var block = {
2020
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
2121
blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
2222
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
23-
html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
23+
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
2424
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
2525
table: noop,
2626
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
@@ -868,7 +868,7 @@ Renderer.prototype.link = function(href, title, text) {
868868
} catch (e) {
869869
return '';
870870
}
871-
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
871+
if (prot.indexOf('javascript:') === 0) {
872872
return '';
873873
}
874874
}
@@ -1154,13 +1154,8 @@ function marked(src, opt, callback) {
11541154

11551155
pending = tokens.length;
11561156

1157-
var done = function(err) {
1158-
if (err) {
1159-
opt.highlight = highlight;
1160-
return callback(err);
1161-
}
1162-
1163-
var out;
1157+
var done = function() {
1158+
var out, err;
11641159

11651160
try {
11661161
out = Parser.parse(tokens, opt);
@@ -1189,7 +1184,6 @@ function marked(src, opt, callback) {
11891184
return --pending || done();
11901185
}
11911186
return highlight(token.text, token.lang, function(err, code) {
1192-
if (err) return done(err);
11931187
if (code == null || code === token.text) {
11941188
return --pending || done();
11951189
}
@@ -1259,7 +1253,7 @@ marked.inlineLexer = InlineLexer.output;
12591253

12601254
marked.parse = marked;
12611255

1262-
if (typeof module !== 'undefined' && typeof exports === 'object') {
1256+
if (typeof exports === 'object') {
12631257
module.exports = marked;
12641258
} else if (typeof define === 'function' && define.amd) {
12651259
define(function() { return marked; });

dist/scripts/api-console.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,14 +1184,17 @@
11841184
//// TODO: Make a uniform interface
11851185
if (scheme && scheme.type === 'OAuth 2.0') {
11861186
authStrategy = new RAML.Client.AuthStrategies.Oauth2(scheme, $scope.credentials);
1187-
authStrategy.authenticate(request.toOptions(), handleResponse);
1187+
authStrategy.authenticate(request.toOptions(), function (jqXhr) {
1188+
$scope.requestOptions = request.toOptions();
1189+
handleResponse(jqXhr);
1190+
});
11881191
return;
11891192
}
11901193

11911194
authStrategy = RAML.Client.AuthStrategies.for(scheme, $scope.credentials);
11921195
authStrategy.authenticate().then(function(token) {
11931196
token.sign(request);
1194-
1197+
$scope.requestOptions = request.toOptions();
11951198
jQuery.ajax(request.toOptions()).then(
11961199
function(data, textStatus, jqXhr) { handleResponse(jqXhr); },
11971200
function(jqXhr) { handleResponse(jqXhr); }

src/app/directives/sidebar.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,17 @@
324324
//// TODO: Make a uniform interface
325325
if (scheme && scheme.type === 'OAuth 2.0') {
326326
authStrategy = new RAML.Client.AuthStrategies.Oauth2(scheme, $scope.credentials);
327-
authStrategy.authenticate(request.toOptions(), handleResponse);
327+
authStrategy.authenticate(request.toOptions(), function (jqXhr) {
328+
$scope.requestOptions = request.toOptions();
329+
handleResponse(jqXhr);
330+
});
328331
return;
329332
}
330333

331334
authStrategy = RAML.Client.AuthStrategies.for(scheme, $scope.credentials);
332335
authStrategy.authenticate().then(function(token) {
333336
token.sign(request);
334-
337+
$scope.requestOptions = request.toOptions();
335338
jQuery.ajax(request.toOptions()).then(
336339
function(data, textStatus, jqXhr) { handleResponse(jqXhr); },
337340
function(jqXhr) { handleResponse(jqXhr); }

0 commit comments

Comments
 (0)