Skip to content

Commit

Permalink
refactor(legacy adapter): add MIGRATION.md deeplinks
Browse files Browse the repository at this point in the history
  • Loading branch information
chimurai committed Mar 5, 2023
1 parent ba740e9 commit 7ed820b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/legacy/options-adapter.ts
Expand Up @@ -31,7 +31,10 @@ export function legacyOptionsAdapter<TReq, TRes>(
if (typeof legacyContext === 'string' && !!url.parse(legacyContext).host) {
throw new Error(
`Shorthand syntax is removed from legacyCreateProxyMiddleware().
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead.`
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead.
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-shorthand-usage
`
);
}

Expand All @@ -49,7 +52,7 @@ export function legacyOptionsAdapter<TReq, TRes>(
pathFilter: '${legacyContext}',
}
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-context-argument
`
);
} else if (legacyContext && !legacyOptions) {
Expand All @@ -74,7 +77,7 @@ export function legacyOptionsAdapter<TReq, TRes>(
},
}
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#refactored-proxy-events
`
);
}
Expand All @@ -97,7 +100,7 @@ export function legacyOptionsAdapter<TReq, TRes>(
logger: console,
}
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-logprovider-and-loglevel-options
`
);
}
Expand Down
5 changes: 4 additions & 1 deletion test/legacy/http-proxy-middleware.spec.ts
Expand Up @@ -13,7 +13,10 @@ describe('legacyCreateProxyMiddleware()', () => {
expect(() => legacyCreateProxyMiddleware(`http://localhost:${mockServer.port}`))
.toThrowErrorMatchingInlineSnapshot(`
"Shorthand syntax is removed from legacyCreateProxyMiddleware().
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead."
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead.
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-shorthand-usage
"
`);
});

Expand Down

0 comments on commit 7ed820b

Please sign in to comment.