1
0
Fork 0

only check 200 responses for if optional

This commit is contained in:
Cyborus 2024-01-16 18:18:38 -05:00
parent edf4646953
commit fed24b52ec
No known key found for this signature in database

View file

@ -495,8 +495,11 @@ fn create_method_response(
) -> eyre::Result<String> {
let mut has_empty = false;
let mut only_empty = true;
for (_, res) in &op.responses.http_codes {
for (code, res) in &op.responses.http_codes {
let name = response_ref_type_name(spec, res)?;
if !code.starts_with("2") {
continue;
}
if name == "()" || name == "empty" {
has_empty = true;
} else {
@ -509,7 +512,7 @@ fn create_method_response(
out.push_str("match response.status().as_u16() {\n");
for (code, res) in &op.responses.http_codes {
let (_, res) = deref_response(spec, res)?;
if code.starts_with("4") {
if !code.starts_with("2") {
continue;
}
out.push_str(code);