Skip to content

Commit 5f6732e

Browse files
authored
Merge pull request #1430 from swagger-api/url_redirect
adding redirect response codes to remote url
2 parents a7e26d6 + 95732ab commit 5f6732e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/RemoteUrl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ public static String urlToString(String url, List<AuthorizationValue> auths) thr
150150
conn.setRequestProperty("User-Agent", USER_AGENT_HEADER_VALUE);
151151
conn.connect();
152152
url = ((HttpURLConnection) conn).getHeaderField("Location");
153-
} while (301 == ((HttpURLConnection) conn).getResponseCode());
153+
} while ((301 == ((HttpURLConnection) conn).getResponseCode())||(302 == ((HttpURLConnection) conn).getResponseCode())
154+
|| (307 == ((HttpURLConnection) conn).getResponseCode())||(308 == ((HttpURLConnection) conn).getResponseCode()));
154155
InputStream in = conn.getInputStream();
155156

156157
StringBuilder contents = new StringBuilder();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RelativeObj:
2+
type: object
3+
properties:
4+
lorem:
5+
type: object
6+
properties:
7+
firstName:
8+
type: string
9+
lastName:
10+
type: string

0 commit comments

Comments
 (0)