Skip to content

Commit b31f06f

Browse files
committed
Merge pull request #157 from mulesoft/bugs/fix-responses-examples
Fix responses examples when you navigate through different methods
2 parents 840b175 + 9379449 commit b31f06f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

dist/scripts/api-console.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@
159159
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
160160
}
161161

162+
$scope.$on('resetData', function() {
163+
if ($scope.methodInfo.responseCodes && $scope.methodInfo.responseCodes.length > 0) {
164+
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
165+
}
166+
});
167+
162168
function beautify(body, contentType) {
163169
if(contentType.indexOf('json')) {
164170
body = vkbeautify.json(body, 2);
@@ -1152,8 +1158,7 @@
11521158
$scope.currentProtocol = $scope.raml.protocols[0];
11531159
$scope.documentationSchemeSelected = defaultSchema;
11541160
$scope.responseDetails = null;
1155-
// removeCustomSchemeData($scope.context.headers);
1156-
// removeCustomSchemeData($scope.context.queryParameters);
1161+
11571162
cleanSchemeMetadata($scope.methodInfo.headers.plain, $scope.context.headers);
11581163
cleanSchemeMetadata($scope.methodInfo.queryParameters, $scope.context.queryParameters);
11591164
});

src/app/directives/documentation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
4242
}
4343

44+
$scope.$on('resetData', function() {
45+
if ($scope.methodInfo.responseCodes && $scope.methodInfo.responseCodes.length > 0) {
46+
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
47+
}
48+
});
49+
4450
function beautify(body, contentType) {
4551
if(contentType.indexOf('json')) {
4652
body = vkbeautify.json(body, 2);

src/app/directives/sidebar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@
207207
$scope.currentProtocol = $scope.raml.protocols[0];
208208
$scope.documentationSchemeSelected = defaultSchema;
209209
$scope.responseDetails = null;
210-
// removeCustomSchemeData($scope.context.headers);
211-
// removeCustomSchemeData($scope.context.queryParameters);
210+
212211
cleanSchemeMetadata($scope.methodInfo.headers.plain, $scope.context.headers);
213212
cleanSchemeMetadata($scope.methodInfo.queryParameters, $scope.context.queryParameters);
214213
});

0 commit comments

Comments
 (0)