package examples import "core:fmt" import "core:testing" import curl "../" @(test) getinfo :: proc(t: ^testing.T) { res: curl.Code hCurl := curl.easy_init() if hCurl == nil do testing.fail_now(t, "failed to init curl") defer curl.easy_cleanup(hCurl); curl.easy_setopt(hCurl, .URL, "https://www.example.com/") res = curl.easy_perform(hCurl); if res != .OK do testing.fail_now(t, fmt.tprintf("got non-OK response for URL: %v", res)) ct: cstring res = curl.easy_getinfo(hCurl, .CONTENT_TYPE, &ct); if res != .OK || ct == nil do testing.fail_now(t, "could not read Content-Type") testing.expectf(t, true, "Content-Type: %s\n", ct) }