final StubHttpLifecycle matchedLifecycle = getMatchedStubHttpLifecycle(assertingLifecycle);
if (ObjectUtils.isNull(matchedLifecycle)) {
return new NotFoundStubResponse();
}
final StubResponse stubResponse = matchedLifecycle.getResponse();
if (matchedLifecycle.isRestricted() && matchedLifecycle.hasNotAuthorized(assertingLifecycle)) {
return new UnauthorizedStubResponse();
}
if (stubResponse.hasHeaderLocation()) {
return RedirectStubResponse.newRedirectStubResponse(stubResponse);
}
if (stubResponse.isRecordingRequired()) {
try {
final StubbyResponse stubbyResponse = stubbyHttpTransport.getResponse(HttpMethods.GET, stubResponse.getBody());
ReflectionUtils.injectObjectFields(stubResponse, "body", stubbyResponse.getContent());
} catch (Exception e) {
}
}