示例#1
0
def _default_link_func(document, link, **parameters):
    """
    When calling a link the default behavior is to call through
    to the HTTP transport layer.
    """
    from coreapi.transport import transition
    return transition(link.url, link.trans, parameters=parameters)
def test_missing_hostname():
    with pytest.raises(TransportError):
        transition('http://')
def test_unknown_scheme():
    with pytest.raises(TransportError):
        transition('ftp://example.org')
def test_missing_scheme():
    with pytest.raises(TransportError):
        transition('example.org')
示例#5
0
def get(url):
    return transition(url, 'follow')