arjun-g / vs-swagger-viewer

Swagger Viewer lets you preview and validate Swagger 2.0 and OpenAPI files as you type in Visual Studio Code.
MIT License
170 stars 47 forks source link

Support customize default host(instead of localhost). #41

Closed beastoin closed 5 years ago

beastoin commented 6 years ago

For the specific project in the real word, for the security issues, we have the need that how to customize both host and post So I think It may be helpful for another. Thank you ;)

Ex: It's lozi.local:port in my case.

slizlaszlo commented 5 years ago

Hi @arjun-g , could you accept this PR, this would be super useful. Thanks in advance :)

alexmcroberts commented 5 years ago

@beastoin the Pull Request is quite a lot larger than it needs to be, mainly because of the file formatting. Making the Pull Request shorter is going to help @arjun-g merge it quicker.

Here's a list of suggested changes:

beastoin commented 5 years ago

@beastoin the Pull Request is quite a lot larger than it needs to be, mainly because of the file formatting. Making the Pull Request shorter is going to help @arjun-g merge it quicker.

Here's a list of suggested changes:

* Remove the .DS_Store file from the Pull Request

* In the file package.json:

  * reset the engine back to `"vscode": "^1.23.0"`
  * change the whitespace to tabs for the lines of code for defining `defaultHost`

* In the file server.ts:

  * Undo all formatting changes:

    * Use tabs instead of spaces
    * Use single quotes instead of double quotes
    * Undo the fixed line length enforced line-wrapping
    * Replace removed round brackets e.g. line [45](https://github.com/arjun-g/vs-swagger-viewer/pull/41/files#diff-fbe3cbee20379f519182721b610e9958R45)
  * I believe the changes in this file only need to be 3 lines:

    * add the `const SERVER_HOST = ...`
    * add the `currentHost: string = SERVER_HOST;`
    * change the `getUrl()` function to include the currentHost value

Very appreciate about your suggestion @alexmcroberts. I have updated the pull request, please check and let me know if there have anything I should change to help @arjun-g merge it quicker.

@slizlaszlo I think it will be merged soon :D, but in case you need, I can support by building a vscode plugin install file.

arjun-g commented 5 years ago

@beastoin thanks and sorry for the delay. A new version of the extension is published with this PR. @alexmcroberts thanks for helping out.

beastoin commented 5 years ago

@beastoin thanks and sorry for the delay. A new version of the extension is published with this PR. @alexmcroberts thanks for helping out.

Thanks 🚀