-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
https support added #7
Conversation
@@ -54,6 +55,7 @@ export default class Request { | |||
|
|||
request.end() | |||
} else { | |||
const req = this._request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super familiar with the browser request component of this, does it not also support https
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mefellows, It does support https as far as I know. https://www.w3.org/TR/XMLHttpRequest/#introduction
Thanks @sk1talets, it's looking good! I'd suggest before merging that we also add an integration-style test that spins up a Mock Server with SSL enabled and smoke test a basic scenario. This will also likely require another configuration item for the Pact server to allow self-signed certificates (this would be the vast majority of cases i'd expect). |
@mefellows, I did this already, if I got you right.. Take a look at -describe('Pact random mock port', () => {
+['http', 'https'].forEach((PROTOCOL) => {
+
+describe(`Pact random mock port, protocol: ${PROTOCOL}`, (protocol) => {
const MOCK_PORT = Math.floor(Math.random() * 999) + 9000
- const PROVIDER_URL = `http://localhost:${MOCK_PORT}`
+ const PROVIDER_URL = `${PROTOCOL}://localhost:${MOCK_PORT}`
const mockServer = wrapper.createServer({
port: MOCK_PORT,
log: path.resolve(process.cwd(), 'logs', 'mockserver-integration.log'),
dir: path.resolve(process.cwd(), 'pacts'),
+ ssl: PROTOCOL === 'https' ? true : false,
spec: 2
})
@@ -37,7 +40,11 @@ describe('Pact random mock port', () => {
beforeEach((done) => {
mockServer.start().then(() => {
- provider = Pact({ consumer: `Consumer ${counter}`, provider: `Provider ${counter}`, port: MOCK_PORT })
+ provider = Pact({ consumer: `Consumer ${counter}`,
+ provider: `Provider ${counter}`,
+ port: MOCK_PORT,
+ ssl: PROTOCOL === 'https' ? true : false
+ }) I hope it's fine. |
@sk1talets Quite right LGTM - merging! We can look at adding https support for browsers in another PR. Much appreciated! |
No description provided.