-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(uptime): Add validator fields for method, body, header #77723
feat(uptime): Add validator fields for method, body, header #77723
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #77723 +/- ##
=======================================
Coverage 78.12% 78.12%
=======================================
Files 6996 6996
Lines 310307 310357 +50
Branches 50770 50776 +6
=======================================
+ Hits 242420 242460 +40
- Misses 56162 56171 +9
- Partials 11725 11726 +1 |
b5b8c6d
to
6aa2a89
Compare
method_headers_body = { | ||
k: v for k, v in validated_data.items() if k in {"method", "headers", "body"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do it like this vs just explicitly having
method=validated_data["methods"],
headers=validated_data["headers"],
body=validated_data["body"],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are optional, this filters out things that weren't passed so that the defaults from the method we call are set.
Although maybe it'd be better to set a default on the fields and just always pass it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah makes sense. I am +1 to defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll handle this as part of the update api. Adding defaults might have some unexpected side effects and I think it's better to get this merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
method_headers_body = { | ||
k: v for k, v in validated_data.items() if k in {"method", "headers", "body"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are optional, this filters out things that weren't passed so that the defaults from the method we call are set.
Although maybe it'd be better to set a default on the fields and just always pass it?
6aa2a89
to
89cbea3
Compare
@@ -28,6 +28,17 @@ | |||
Importantly domains like `vercel.dev` are considered TLDs as defined by the | |||
public suffix list (PSL). See `extract_domain_parts` fo more details | |||
""" | |||
SUPPORTED_HTTP_METHODS = ["GET", "POST", "HEAD", "PUT", "DELETE", "PATCH", "OPTIONS"] | |||
MAX_REQUEST_SIZE_BYTES = 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should have done 1024 to be sane. nbd
89cbea3
to
871f9f3
Compare
Adds new fields to the validator matching up with #77611 --------- Co-authored-by: Dan Fuller <[email protected]>
Adds new fields to the validator matching up with #77611 --------- Co-authored-by: Dan Fuller <[email protected]>
Adds new fields to the validator matching up with #77611