@@ -54,7 +54,8 @@ pub struct Action {
5454#[ derive( Clone , Debug ) ]
5555pub struct History {
5656 status : StatusCode ,
57- uri : Uri ,
57+ location : Uri ,
58+ previous : Uri ,
5859 headers : HeaderMap ,
5960}
6061
@@ -238,20 +239,29 @@ impl<'a> Attempt<'a> {
238239// ===== impl History =====
239240
240241impl History {
241- /// Get the status code of the redirect response.
242+ /// Returns the redirection response.
243+ #[ inline( always) ]
242244 pub fn status ( & self ) -> StatusCode {
243245 self . status
244246 }
245247
246- /// Get the URI of the redirect response.
247- pub fn uri ( & self ) -> & Uri {
248- & self . uri
249- }
250-
251- /// Get the headers of the redirect response.
248+ /// Returns the headers of the redirection response.
249+ #[ inline( always) ]
252250 pub fn headers ( & self ) -> & HeaderMap {
253251 & self . headers
254252 }
253+
254+ /// Returns the destination URI of the redirection.
255+ #[ inline( always) ]
256+ pub fn location ( & self ) -> & Uri {
257+ & self . location
258+ }
259+
260+ /// Returns the URI of the original request.
261+ #[ inline( always) ]
262+ pub fn previous ( & self ) -> & Uri {
263+ & self . previous
264+ }
255265}
256266
257267#[ derive( Clone ) ]
@@ -385,7 +395,8 @@ impl policy::Policy<Body, BoxError> for FollowRedirectPolicy {
385395 . get_or_insert_with ( Vec :: new)
386396 . push ( History {
387397 status : attempt. status ( ) ,
388- uri : attempt. location ( ) . clone ( ) ,
398+ location : attempt. location ( ) . clone ( ) ,
399+ previous : attempt. previous ( ) . clone ( ) ,
389400 headers : attempt. headers ( ) . clone ( ) ,
390401 } ) ;
391402 }
0 commit comments