More test + fix decodeURIComponent call

Previously I was calling decodeURIComponent on regex match result which
was an array. This fixes that and alos adds more tests
This commit is contained in:
Mohsen Azimi
2015-01-30 16:34:08 -08:00
parent 9e8473308f
commit ae4686b0dd
3 changed files with 31 additions and 4 deletions

View File

@@ -24,9 +24,9 @@
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
var url = decodeURIComponent(window.location.search.match(/url=([^&]+)/));
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
url = decodeURIComponent(url[1]);
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
}