@@ -2381,6 +2381,43 @@ func TestRequestFuncs(t *testing.T) {
23812381 assertEqual (t , "TestGet: text response" , resp .String ())
23822382}
23832383
2384+ func TestHTTPWarnGH970 (t * testing.T ) {
2385+ lookupText := "Using sensitive credentials in HTTP mode is not secure. Use HTTPS"
2386+
2387+ t .Run ("SSL used" , func (t * testing.T ) {
2388+ ts := createAuthServerTLSOptional (t , true )
2389+ defer ts .Close ()
2390+
2391+ c , lb := dcldb ()
2392+ c .SetBaseURL (ts .URL ).
2393+ SetTLSClientConfig (& tls.Config {InsecureSkipVerify : true })
2394+
2395+ res , err := c .R ().
2396+ SetAuthToken ("004DDB79-6801-4587-B976-F093E6AC44FF" ).
2397+ Get ("/profile" )
2398+
2399+ assertNil (t , err )
2400+ assertEqual (t , true , strings .Contains (res .String (), "profile fetch successful" ))
2401+ assertEqual (t , false , strings .Contains (lb .String (), lookupText ))
2402+ })
2403+
2404+ t .Run ("non-SSL used" , func (t * testing.T ) {
2405+ ts := createAuthServerTLSOptional (t , false )
2406+ defer ts .Close ()
2407+
2408+ c , lb := dcldb ()
2409+ c .SetBaseURL (ts .URL )
2410+
2411+ res , err := c .R ().
2412+ SetAuthToken ("004DDB79-6801-4587-B976-F093E6AC44FF" ).
2413+ Get ("/profile" )
2414+
2415+ assertNil (t , err )
2416+ assertEqual (t , true , strings .Contains (res .String (), "profile fetch successful" ))
2417+ assertEqual (t , true , strings .Contains (lb .String (), lookupText ))
2418+ })
2419+ }
2420+
23842421// This test methods exist for test coverage purpose
23852422// to validate the getter and setter
23862423func TestRequestSettingsCoverage (t * testing.T ) {
0 commit comments