|
1 | 1 | """HTTPX client request adapter."""
|
2 | 2 | import re
|
3 |
| -from collections.abc import AsyncIterable, Iterable |
4 | 3 | from datetime import datetime
|
5 | 4 | from typing import Any, Dict, Generic, List, Optional, TypeVar, Union
|
6 | 5 | from urllib import parse
|
7 |
| -from urllib.parse import unquote |
8 | 6 |
|
9 | 7 | import httpx
|
10 | 8 | from kiota_abstractions.api_client_builder import (
|
@@ -63,29 +61,29 @@ class HttpxRequestAdapter(RequestAdapter, Generic[ModelType]):
|
63 | 61 | def __init__(
|
64 | 62 | self,
|
65 | 63 | authentication_provider: AuthenticationProvider,
|
66 |
| - parse_node_factory: ParseNodeFactory = ParseNodeFactoryRegistry(), |
67 |
| - serialization_writer_factory: |
68 |
| - SerializationWriterFactory = SerializationWriterFactoryRegistry(), |
69 |
| - http_client: httpx.AsyncClient = KiotaClientFactory.create_with_default_middleware(), |
70 |
| - base_url: str = "", |
71 |
| - observability_options=ObservabilityOptions(), |
| 64 | + parse_node_factory: Optional[ParseNodeFactory] = None, |
| 65 | + serialization_writer_factory: Optional[SerializationWriterFactory] = None, |
| 66 | + http_client: Optional[httpx.AsyncClient] = None, |
| 67 | + base_url: Optional[str] = None, |
| 68 | + observability_options: Optional[ObservabilityOptions] = None, |
72 | 69 | ) -> None:
|
73 | 70 | if not authentication_provider:
|
74 | 71 | raise TypeError("Authentication provider cannot be null")
|
75 | 72 | self._authentication_provider = authentication_provider
|
76 | 73 | if not parse_node_factory:
|
77 |
| - raise TypeError("Parse node factory cannot be null") |
| 74 | + parse_node_factory = ParseNodeFactoryRegistry() |
78 | 75 | self._parse_node_factory = parse_node_factory
|
79 | 76 | if not serialization_writer_factory:
|
80 |
| - raise TypeError("Serialization writer factory cannot be null") |
| 77 | + serialization_writer_factory = SerializationWriterFactoryRegistry() |
81 | 78 | self._serialization_writer_factory = serialization_writer_factory
|
82 | 79 | if not http_client:
|
83 |
| - raise TypeError("Http Client cannot be null") |
84 |
| - if not observability_options: |
85 |
| - observability_options = ObservabilityOptions() |
86 |
| - |
| 80 | + http_client = KiotaClientFactory.create_with_default_middleware() |
87 | 81 | self._http_client = http_client
|
| 82 | + if not base_url: |
| 83 | + base_url = "" |
88 | 84 | self._base_url: str = base_url
|
| 85 | + if not observability_options: |
| 86 | + observability_options = ObservabilityOptions() |
89 | 87 | self.observability_options = observability_options
|
90 | 88 |
|
91 | 89 | @property
|
|
0 commit comments