Skip to content

Commit

Permalink
Merge pull request #1430 from swagger-api/url_redirect
Browse files Browse the repository at this point in the history
adding redirect response codes to remote url
  • Loading branch information
gracekarina authored Sep 21, 2020
2 parents a7e26d6 + 95732ab commit 5f6732e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public static String urlToString(String url, List<AuthorizationValue> auths) thr
conn.setRequestProperty("User-Agent", USER_AGENT_HEADER_VALUE);
conn.connect();
url = ((HttpURLConnection) conn).getHeaderField("Location");
} while (301 == ((HttpURLConnection) conn).getResponseCode());
} while ((301 == ((HttpURLConnection) conn).getResponseCode())||(302 == ((HttpURLConnection) conn).getResponseCode())
|| (307 == ((HttpURLConnection) conn).getResponseCode())||(308 == ((HttpURLConnection) conn).getResponseCode()));
InputStream in = conn.getInputStream();

StringBuilder contents = new StringBuilder();
Expand Down
10 changes: 10 additions & 0 deletions modules/swagger-parser-v3/src/test/resources/relativeTest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RelativeObj:
type: object
properties:
lorem:
type: object
properties:
firstName:
type: string
lastName:
type: string

0 comments on commit 5f6732e

Please sign in to comment.