Skip to content

Commit 8a06904

Browse files
committed
Remove GetRedirectLocation in favor of FollowRedirects
1 parent 867a5a7 commit 8a06904

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

specs/Specs_WebClient.bas

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,6 @@ Public Function Specs() As SpecSuite
258258

259259
' SetProxy
260260

261-
' GetRedirectLocation
262-
' --------------------------------------------- '
263-
With Specs.It("should GetRedirectLocation of Request")
264-
Set Request = New WebRequest
265-
Request.Resource = "redirect/1"
266-
267-
Dim RedirectLocation As String
268-
RedirectLocation = Client.GetRedirectLocation(Request)
269-
270-
.Expect(RedirectLocation).ToEqual "/get"
271-
End With
272-
273261
' GetFullUrl
274262
' --------------------------------------------- '
275263
With Specs.It("should GetFullUrl of Request")

src/WebClient.cls

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -458,26 +458,6 @@ Public Sub SetProxy(ProxyServer As String, _
458458
Me.ProxyBypassList = BypassList
459459
End Sub
460460

461-
''
462-
' If the given Request is a redirect (301, 302, or 307),
463-
' then get value of the "Location" header
464-
'
465-
' @param {WebRequest} Request
466-
' @return {String}
467-
''
468-
Public Function GetRedirectLocation(Request As WebRequest) As String
469-
Dim RedirectRequest As WebRequest
470-
Set RedirectRequest = Request.Clone
471-
RedirectRequest.Method = WebMethod.HttpHead
472-
473-
Dim Response As WebResponse
474-
Set Response = Me.Execute(RedirectRequest)
475-
476-
If Response.StatusCode = 301 Or Response.StatusCode = 302 Or Response.StatusCode = 307 Then
477-
GetRedirectLocation = WebHelpers.FindInKeyValues(Response.Headers, "Location")
478-
End If
479-
End Function
480-
481461
''
482462
' Get full url by joining given `WebRequest.FormattedResource` and `BaseUrl`.
483463
'

0 commit comments

Comments
 (0)