tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
604 stars 188 forks source link

net/http: support for cookies when https #439

Closed sago35 closed 2 years ago

sago35 commented 2 years ago

Until now, cookies were enabled only for HTTP. Fix implemented and verified to work correctly.

https://httpbin.org/#/Cookies/get_cookies

    // cookie
    jar, err := cookiejar.New(nil)
    if err != nil {
        log.Fatal(err)
    }
    client := &http.Client{Jar: jar}
    http.DefaultClient = client

    url = "https://httpbin.org/cookies/set/name/there"
    res, err := http.Get(url)
    if err != nil {
        log.Fatal(err)
    }

and

        url = "https://httpbin.org/cookies"
        res, err := http.Get(url)
        if err != nil {
            log.Fatal(err)
        }
deadprogram commented 2 years ago

Thank you @sago35 now merging.