Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
specs - fix spec recording on / (in that particular case, / was not p…
…resent in spec).

This fixes #176
  • Loading branch information
fcamblor committed Aug 24, 2017
1 parent 515d8e8 commit b9d5e2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -183,7 +183,7 @@ adminApp.controller('OperationController', function OperationController(
spec = { title: data.title, requests: [] };
data.whens.forEach(function (when) {
spec.requests.push({
httpMethod: when.method, path: '/' + when.path, body: when.body, showBody: when.body.trim() !== '',
httpMethod: when.method, path: ((when.path === '/')?'':'/') + when.path, body: when.body, showBody: when.body.trim() !== '',
response: { body: when.then.expected, status: when.then.expectedCode }});
});
$scope.specs.push(spec);
Expand Down
2 changes: 1 addition & 1 deletion restx-core/src/main/java/restx/specs/RestxSpecTape.java
Expand Up @@ -116,7 +116,7 @@ public RestxSpecTape doRecord(final Optional<String> recordPath,
Stopwatch stopwatch = Stopwatch.createStarted();
System.out.print("RECORDING REQUEST...");
final String method = restxRequest.getHttpMethod();
final String path = restxRequest.getRestxUri().substring(1); // remove leading slash
final String path = (restxRequest.getRestxUri().length()>1)?restxRequest.getRestxUri().substring(1):restxRequest.getRestxUri(); // remove leading slash
final ImmutableMap<String, String> cookies =
sessionFilter.toCookiesMap(sessionFilter.buildContextFromRequest(restxRequest));
final byte[] requestBody = ByteStreams.toByteArray(restxRequest.getContentStream());
Expand Down

0 comments on commit b9d5e2b

Please sign in to comment.