Skip to content

Commit 74bb1c3

Browse files
committed
feat(XHTTPTransportConfig): add field validator to normalize numeric fields
1 parent e88037f commit 74bb1c3

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

app/models/subscription.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ class XHTTPTransportConfig(BaseTransportConfig):
125125
http_headers: dict[str, str] | None = Field(None)
126126
random_user_agent: bool = Field(False)
127127

128+
@field_validator(
129+
"sc_max_each_post_bytes",
130+
"sc_min_posts_interval_ms",
131+
"uplink_chunk_size",
132+
mode="before",
133+
)
134+
@classmethod
135+
def normalize_numeric_or_range_fields(cls, value):
136+
if isinstance(value, int):
137+
return str(value)
138+
return value
139+
128140

129141
class KCPTransportConfig(BaseTransportConfig):
130142
"""KCP transport - only kcp-specific fields"""

0 commit comments

Comments
 (0)