Skip to content

Commit 9284381

Browse files
committed
[Functions] Use the right object to compare MediaType
By relying on the `MediaType` class, we can get more normalized results.
1 parent d0dc250 commit 9284381

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

firebase-functions/src/main/java/com/google/firebase/functions/PublisherStream.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,8 @@ internal class PublisherStream(
296296
private fun validateResponse(response: Response) {
297297
if (response.isSuccessful) return
298298

299-
val htmlContentType = "text/html; charset=utf-8"
300299
val errorMessage: String
301-
if (response.code() == 404 && response.header("Content-Type") == htmlContentType) {
300+
if (response.code() == 404 && MediaType.get(response.header("Content-Type")?: "").subtype() == "html") {
302301
errorMessage = """URL not found. Raw response: ${response.body()?.string()}""".trimMargin()
303302
notifyError(
304303
FirebaseFunctionsException(

0 commit comments

Comments
 (0)