diff --git a/library/src/main/java/com/bumptech/glide/load/model/LazyHeaders.java b/library/src/main/java/com/bumptech/glide/load/model/LazyHeaders.java index 915185fbde..1e4328b9c1 100644 --- a/library/src/main/java/com/bumptech/glide/load/model/LazyHeaders.java +++ b/library/src/main/java/com/bumptech/glide/load/model/LazyHeaders.java @@ -117,9 +117,9 @@ public static final class Builder { } private boolean copyOnModify = true; - private boolean isEncodingDefault = true; private Map> headers = DEFAULT_HEADERS; - private boolean isUserAgentDefault = headers.containsKey(DEFAULT_USER_AGENT); + private boolean isEncodingDefault = true; + private boolean isUserAgentDefault = true; /** * Adds a value for the given header and returns this builder. diff --git a/library/src/test/java/com/bumptech/glide/load/model/LazyHeadersTest.java b/library/src/test/java/com/bumptech/glide/load/model/LazyHeadersTest.java index 8e0269c4e1..04e4151a4c 100644 --- a/library/src/test/java/com/bumptech/glide/load/model/LazyHeadersTest.java +++ b/library/src/test/java/com/bumptech/glide/load/model/LazyHeadersTest.java @@ -8,6 +8,8 @@ import com.bumptech.glide.load.model.LazyHeaders.Builder; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -18,6 +20,22 @@ @RunWith(RobolectricTestRunner.class) @Config(manifest = Config.NONE, sdk = 18) public class LazyHeadersTest { + private static final String DEFAULT_USER_AGENT = "default_user_agent"; + private static final String DEFAULT_USER_AGENT_PROPERTY = "http.agent"; + private String initialUserAgent; + + @Before + public void setUp() { + initialUserAgent = System.getProperty(DEFAULT_USER_AGENT_PROPERTY); + System.setProperty(DEFAULT_USER_AGENT_PROPERTY, DEFAULT_USER_AGENT); + } + + @After + public void tearDown() { + if (initialUserAgent != null) { + System.setProperty(DEFAULT_USER_AGENT_PROPERTY, initialUserAgent); + } + } @Test public void testIncludesEagerHeaders() {