microsoft / vscode-apimanagement

VS Code extension for Azure API Management.
MIT License
60 stars 40 forks source link

Use the default "hostnameConfigurations" properties instead of "gatewayURL" when generating Test Requests #198

Closed ivanthelad closed 3 years ago

ivanthelad commented 3 years ago

when generating a test operation against an API, the plugin reference the property "gatewayURL" on the apim service. this may not always be desired as a project can also configure a different default custom domain for their apim service gateway.

Operation generation grabs the gatewayURL https://github.com/microsoft/vscode-apimanagement/blob/07a8c123d805ed23fd7521cbfac4894b63c8ba66/src/operationConsole/OperationConsole.ts#L26

An alternative, is to check if the property "hostnameConfigurations" and the value of hostnameConfigurations.proxy.hostName instead. "hostnameConfigurations": [ { "type": "Proxy", "hostName": "mycustomurl.com", "encodedCertificate": null, "keyVaultId": "https://xxxxx.vault.azure.net/secrets/apim", "certificatePassword": null, "negotiateClientCertificate": false, "certificate": { "expiry": "xxxxxx", "thumbprint": "xxxxxx", "subject": "CN=mycustomurl.com" }, "defaultSslBinding": true } ],

The change would need to be done inside the requestURL method https://github.com/microsoft/vscode-apimanagement/blob/07a8c123d805ed23fd7521cbfac4894b63c8ba66/src/operationConsole/OperationConsole.ts#L120

miaojiang commented 3 years ago

In the latest release, you can use the "set gateway URL" feature (right click on the APIM service instance).