Last active
October 24, 2017 04:14
-
-
Save dekokun/7da6caf00658f2a184352112db9bcc18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/marcw/cachecontrol" | |
"strings" | |
) | |
func main() { | |
ccs := []string{"public", "max-age=315360000"} | |
directive := strings.Join(ccs, " ") | |
cc := cachecontrol.Parse(directive) | |
fmt.Println("# publicが先だとpublic扱いにならない") | |
fmt.Println(ccs) | |
fmt.Println(cc.Public()) | |
ccs2 := []string{"max-age=315360000", "public"} | |
directive2 := strings.Join(ccs, " ") | |
cc2 := cachecontrol.Parse(directive2) | |
fmt.Println("# publicが後だとpublic扱いになる") | |
fmt.Println(ccs2) | |
fmt.Println(cc2.Public()) | |
ccs3 := []string{"public", "max-age=315360000"} | |
directive3 := strings.Join(ccs, " ") | |
cc3 := cachecontrol.Parse(directive3) | |
fmt.Println("# publicが先でもカンマでJoinするとpublic扱いになる") | |
fmt.Println(ccs3) | |
fmt.Println(cc3.Public()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
結果: