multithreadTest.py
def runTest(self):
        """CONFORMANCE TEST - Testing Conditional GET"""
        print("\nMaking a Normal GET Request")
        try:
            headers = dict()
            r = requests.get(SERVER_URL + "/")
            print(f"Status : {r.status_code} {r.reason}")
            lastModified = r.headers['Last-Modified']
            headers['If-Modified-Since'] = lastModified
            print(f"Last Modified Date Obtained : {lastModified}")
            print(f"Sending a conditional GET with the If-Mod-Since same as Last-Modified")
            r = requests.get(SERVER_URL + "/", headers=headers)
            print(f"Status : {r.status_code} {r.reason}")
            print(f"Sending a conditional GET with the If-Mod-Since older than Last-Modified")
            headers['If-Modified-Since'] = "Tue, 27 Oct 1999 08:57:08 GMT"
            r = requests.get(SERVER_URL + "/", headers=headers)
            print(f"Status : {r.status_code} {r.reason}")
        except Exception as ex:
            print('Something went horribly wrong!', ex)
        finally:
            # Stop all running threads
            return
CONFORMANCE TEST - Testing Conditional GET
CONFORMANCE TEST - Testing Conditional GET
CONFORMANCE TEST - Testing Conditional GET
def runTest(self):
        print("\nMaking a Normal GET Request")
        try:
            headers = dict()
            r = requests.get(SERVER_URL + "/")
            print(f"Status : {r.status_code} {r.reason}")
            lastModified = r.headers['Last-Modified']
            headers['If-Modified-Since'] = lastModified
            print(f"Last Modified Date Obtained : {lastModified}")
            print(f"Sending a conditional GET with the If-Mod-Since same as Last-Modified")
            r = requests.get(SERVER_URL + "/", headers=headers)
            print(f"Status : {r.status_code} {r.reason}")
            print(f"Sending a conditional GET with the If-Mod-Since older than Last-Modified")
            headers['If-Modified-Since'] = "Tue, 27 Oct 1999 08:57:08 GMT"
            r = requests.get(SERVER_URL + "/", headers=headers)
            print(f"Status : {r.status_code} {r.reason}")
        except Exception as ex:
            print('Something went horribly wrong!', ex)
        finally:
            return
def runTest ( self ) : print ( "\nMaking a Normal GET Request" ) try : headers = dict ( ) r = requests . get ( SERVER_URL + "/" ) print ( f"Status : {r.status_code} {r.reason}" ) lastModified = r . headers [ 'Last-Modified' ] headers [ 'If-Modified-Since' ] = lastModified print ( f"Last Modified Date Obtained : {lastModified}" ) print ( f"Sending a conditional GET with the If-Mod-Since same as Last-Modified" ) r = requests . get ( SERVER_URL + "/" , headers = headers ) print ( f"Status : {r.status_code} {r.reason}" ) print ( f"Sending a conditional GET with the If-Mod-Since older than Last-Modified" ) headers [ 'If-Modified-Since' ] = "Tue, 27 Oct 1999 08:57:08 GMT" r = requests . get ( SERVER_URL + "/" , headers = headers ) print ( f"Status : {r.status_code} {r.reason}" ) except Exception as ex : print ( 'Something went horribly wrong!' , ex ) finally : return
CONFORMANCE TEST - Testing Conditional GET
CONFORMANCE TEST - Testing Conditional GET
"""CONFORMANCE TEST - Testing Conditional GET""" # Stop all running threads
self