/* Timelinize Copyright (c) 2013 Matthew Holt This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package tlzapp import ( "reflect" "testing" ) func TestParseAccept(t *testing.T) { for i, tc := range []struct { input string expect acceptHeader shouldErr bool }{ { input: "image/avif,image/webp,*/*", expect: acceptHeader{ {mimeType: "image/avif", weight: 1}, {mimeType: "image/webp", weight: 1}, {mimeType: "*/*", weight: 1}, }, }, { // safari's tag, believe it or not input: "image/webp,image/avif,image/jxl,image/heic,image/heic-sequence,video/*;q=0.8,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5", expect: acceptHeader{ {mimeType: "image/webp", weight: 1}, {mimeType: "image/avif", weight: 1}, {mimeType: "image/jxl", weight: 1}, {mimeType: "image/heic", weight: 1}, {mimeType: "image/heic-sequence", weight: 1}, {mimeType: "image/png", weight: 1}, {mimeType: "image/svg+xml", weight: 1}, {mimeType: "video/*", weight: 0.8}, {mimeType: "image/*", weight: 0.8}, {mimeType: "*/*", weight: 0.5}, }, }, { // Chrome's