Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix basePath bug and add details to various validation debug messages. #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mschaef-da
Copy link
Contributor

No description provided.

mschaef-da and others added 3 commits December 4, 2018 15:28
Update module name passed to debug so that it matches both the instru…
const matchUrlWithSchema = (reqUrl) => {
let url = parseUrl(reqUrl).pathname;
if (options.schema.basePath) {
url = url.replace(options.schema.basePath, '');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code will replace occurrences of the basepath that occur in the middle of the input URL. (As long as they are the first such instance.)

> const basePath = '/b';
undefined
> '/a/b/c/d'.replace(basePath, '')
'/a/c/d'

@@ -136,7 +144,7 @@ const validateResponse = (req, res, next) => {

const responseSchema = resolveResponseModelSchema(req, res);
if (!responseSchema) {
debug('Response validation skipped: no matching response schema');
debug(`Response validation skipped: no matching response schema for ${req.method} ${req.originalUrl}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent behind these changes is to make it easier to see which requests are not covered by a given schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant