MCPcopy Create free account
hub / github.com/pallets/quart / _make_request

Method _make_request

src/quart/testing/client.py:404–457  ·  view source on GitHub ↗
(
        self,
        path: str,
        method: str,
        headers: dict | Headers | None,
        data: AnyStr | None,
        form: dict | None,
        files: dict[str, FileStorage] | None,
        query_string: dict | None,
        json: Any,
        scheme: str,
        root_path: str,
        http_version: str,
        scope_base: dict | None,
        auth: Authorization | tuple[str, str] | None = None,
        subdomain: str | None = None,
    )

Source from the content-addressed store, hash-verified

402 break
403
404 async def _make_request(
405 self,
406 path: str,
407 method: str,
408 headers: dict | Headers | None,
409 data: AnyStr | None,
410 form: dict | None,
411 files: dict[str, FileStorage] | None,
412 query_string: dict | None,
413 json: Any,
414 scheme: str,
415 root_path: str,
416 http_version: str,
417 scope_base: dict | None,
418 auth: Authorization | tuple[str, str] | None = None,
419 subdomain: str | None = None,
420 ) -> Response:
421 headers, path, query_string_bytes = make_test_headers_path_and_query_string(
422 self.app, path, headers, query_string, auth, subdomain
423 )
424 request_data, body_headers = make_test_body_with_headers(
425 data=data, form=form, files=files, json=json, app=self.app
426 )
427 headers.update(**body_headers)
428
429 if self.cookie_jar is not None:
430 for cookie in self.cookie_jar:
431 headers.add("cookie", f"{cookie.name}={cookie.value}")
432
433 scope = make_test_scope(
434 "http",
435 path,
436 method,
437 headers,
438 query_string_bytes,
439 scheme,
440 root_path,
441 http_version,
442 scope_base,
443 _preserve_context=self.preserve_context,
444 )
445 async with self.http_connection_class(
446 self.app, scope, _preserve_context=self.preserve_context
447 ) as connection:
448 await connection.send(request_data)
449 await connection.send_complete()
450 response = await connection.as_response()
451 if self.cookie_jar is not None:
452 self.cookie_jar.extract_cookies(
453 _TestCookieJarResponse(response.headers), # type: ignore
454 U2Request(f"{scheme}://{headers['host']}{path}"),
455 )
456 self.push_promises.extend(connection.push_promises)
457 return response

Callers 1

openMethod · 0.95

Calls 8

make_test_scopeFunction · 0.85
extendMethod · 0.80
sendMethod · 0.45
send_completeMethod · 0.45
as_responseMethod · 0.45

Tested by

no test coverage detected