Exemplo n.º 1
0
def test_header_set() -> None:
    updated = False

    def on_update(_: HeaderSet) -> None:
        nonlocal updated
        updated = True

    header_set = HeaderSet.from_header('GET, HEAD', on_update=on_update)
    assert header_set.to_header() in {'GET, HEAD', 'HEAD, GET'}
    assert updated is False
    header_set.add('PUT')
    assert updated
Exemplo n.º 2
0
def test_header_set() -> None:
    updated = False

    def on_update(_: HeaderSet) -> None:
        nonlocal updated
        updated = True

    header_set = HeaderSet.from_header("GET, HEAD", on_update=on_update)
    assert header_set.to_header() in {"GET, HEAD", "HEAD, GET"}
    assert updated is False
    header_set.add("PUT")
    assert updated