Permalink
Browse files

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 b9d5e2b022b04e755b3e248a7752925e2b3ebd6c
@@ -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);
@@ -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());

0 comments on commit b9d5e2b

Please sign in to comment.