Skip to content

Commit

Permalink
Enable ETags (#337)
Browse files Browse the repository at this point in the history
This reverts commit df0ac27.
  • Loading branch information
vegaro authored Jul 9, 2021
1 parent afa4870 commit eed77c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ class ETagManager(
) {

internal fun getETagHeader(
@SuppressWarnings("UnusedPrivateMember")
path: String,
@SuppressWarnings("UnusedPrivateMember")
refreshETag: Boolean = false
): Map<String, String> {
// Always return "" until request date issue is figured out
val eTagHeader = ETAG_HEADER_NAME to ""
val eTagHeader = ETAG_HEADER_NAME to if (refreshETag) "" else getETag(path)
return mapOf(eTagHeader)
}

Expand Down Expand Up @@ -114,7 +111,6 @@ class ETagManager(
}
}

@SuppressWarnings("UnusedPrivateMember")
private fun getETag(path: String): String {
return getStoredResultSavedInSharedPreferences(path)?.eTag.orEmpty()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class ETagManagerTest {
}

@Test
fun `An ETag header is never added even if there is an ETag saved for that request`() {
fun `An ETag header is added if there is an ETag saved for that request`() {
val path = "/v1/subscribers/appUserID"
val expectedETag = ""
val expectedETag = "etag"
mockCachedHTTPResult(expectedETag, path)

val requestWithETagHeader = underTest.getETagHeader(path)
Expand Down

0 comments on commit eed77c4

Please sign in to comment.