ServiceNow / servicenow-cicd-azure-extension

Extension for Azure Pipelines to help developers get started faster with ServiceNow's CI/CD APIs
MIT License
12 stars 18 forks source link

Update ServiceNowCICDRestAPIService.js #17

Closed vinay2099 closed 3 years ago

vinay2099 commented 3 years ago

Added line 26 (Regular expression that removes https from instance URL and keeps the extra parameters )

If the URL is https://servicenow-cicd-proxy.azure-api.net/ing then the output of line 26 in the code (before this pull request ) will give output as 'servicenow-cicd-proxy.azure-api.net' but in our case we need the ouput as 'servicenow-cicd-proxy.azure-api.net/ing'.

So, I have added a new line of code in the PR so that it works in both the ways.

example : 1.) instance= "https://servicenow-cicd-proxy.azure-api.net/ing"; instance = instance.replace(/(^\https:|^)\/\//, '').replace(/^\/|\/$/g, ''); console.log(instance);

output : servicenow-cicd-proxy.azure-api.net/ing

2.) instance= "https://servicenow-cicd-proxy.azure-api.net/"; instance = instance.replace(/(^\https:|^)\/\//, '').replace(/^\/|\/$/g, ''); console.log(instance);

output : servicenow-cicd-proxy.azure-api.net

If you need more clarity on this thing we can have a call and disucss further but we really wish this will be added to the upcoming release

vinay2099 commented 3 years ago

Hello @chiarnglin

Can you have a look at this and provide your inputs.

Kind regards, Vinay

chiarng commented 3 years ago

@vinay2099 hey! sorry, was out on Thanksgiving break. merged and published as 1.8.0, thanks for contributing the update, I think it also addressed one of the URL ending slash oddities I was looking at.