File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
main/java/com/google/api/client/http
test/java/com/google/api/client/http Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,10 @@ public HttpHeaders() {
168
168
@ Key ("WWW-Authenticate" )
169
169
private List <String > authenticate ;
170
170
171
+ /** {@code "Age"} header. */
172
+ @ Key ("Age" )
173
+ private List <Long > age ;
174
+
171
175
@ Override
172
176
public HttpHeaders clone () {
173
177
return (HttpHeaders ) super .clone ();
@@ -804,6 +808,30 @@ public HttpHeaders setAuthenticate(String authenticate) {
804
808
return this ;
805
809
}
806
810
811
+ /**
812
+ * Returns the first {@code "Age"} header or {@code null} for none.
813
+ *
814
+ * @since 1.14
815
+ */
816
+ public final Long getAge () {
817
+ return getFirstHeaderValue (age );
818
+ }
819
+
820
+ /**
821
+ * Sets the {@code "Age"} header or {@code null} for none.
822
+ *
823
+ * <p>
824
+ * Overriding is only supported for the purpose of calling the super implementation and changing
825
+ * the return type, but nothing else.
826
+ * </p>
827
+ *
828
+ * @since 1.14
829
+ */
830
+ public HttpHeaders setAge (Long age ) {
831
+ this .age = getAsList (age );
832
+ return this ;
833
+ }
834
+
807
835
/**
808
836
* Sets the {@link #authorization} header as specified in <a
809
837
* href="http://tools.ietf.org/html/rfc2617#section-2">Basic Authentication Scheme</a>.
Original file line number Diff line number Diff line change @@ -234,6 +234,16 @@ public static class SlugHeaders extends HttpHeaders {
234
234
String slug ;
235
235
}
236
236
237
+ public void testParseAge () throws Exception {
238
+ MockLowLevelHttpResponse httpResponse = new MockLowLevelHttpResponse ()
239
+ .setHeaderNames (Arrays .asList ("Age" ))
240
+ .setHeaderValues (Arrays .asList ("3456" ));
241
+
242
+ HttpHeaders httpHeaders = new HttpHeaders ();
243
+ httpHeaders .fromHttpResponse (httpResponse , null );
244
+ assertEquals (3456L , httpHeaders .getAge ().longValue ());
245
+ }
246
+
237
247
public void testFromHttpResponse_normalFlow () throws Exception {
238
248
MockLowLevelHttpResponse httpResponse = new MockLowLevelHttpResponse ().setHeaderNames (
239
249
Arrays .asList ("Content-Type" , "Slug" ))
You can’t perform that action at this time.
0 commit comments