-
Notifications
You must be signed in to change notification settings - Fork 0
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
Re generate cadl ranch tests #8
base: improve-static-file-handling
Are you sure you want to change the base?
Re generate cadl ranch tests #8
Conversation
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.
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
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 is this duplicated?
if (isUnexpected(response)) { | ||
throw createRestError( | ||
`Pagination failed with unexpected statusCode ${response.status}`, | ||
response, | ||
); | ||
const statusCode = Number(response.status); | ||
if (statusCode < 200 || statusCode >= 300) { | ||
if (statusCode >= 400 && statusCode < 500) { | ||
throw createRestError( | ||
`Pagination failed with client error statusCode ${response.status}`, | ||
response, | ||
); | ||
} else if (statusCode >= 500) { | ||
throw createRestError( | ||
`Pagination failed with server error statusCode ${response.status}`, | ||
response, | ||
); | ||
} else { | ||
throw createRestError( | ||
`Pagination failed with unexpected statusCode ${response.status}`, | ||
response, | ||
); | ||
} |
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.
not quite sure why we remove isUnexpected helper ?
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.
is it part of the removing rlc types change?
@@ -1,20 +1,105 @@ | |||
// Copyright (c) Microsoft Corporation. | |||
// Licensed under the MIT license. |
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.
If I remember correctly, not everything is static in paging helpers, for example
Line 119 in 5864915
const nextLinkName = options.nextLinkName ?? "nextLink"; |
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.
this nextlinkname option should be fixed in paging helper but could be configed differently in places called this helper -
Line 482 in 5864915
{ itemName: "value", nextLinkName: "nextLink" }, |
PagedAsyncIterableIterator, | ||
} from "./models/index.js"; | ||
export { User, ListOptionalParams } from "./models/index.js"; | ||
export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; |
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.
Just curious, why we import first and then export them instead of export them directly?
const Http2xxStatusCodes = [ | ||
"200", | ||
"201", | ||
"202", | ||
"203", | ||
"204", | ||
"205", | ||
"206", | ||
"207", | ||
"208", | ||
"226", | ||
]; |
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 that means we have supported range status Azure#2063 @MaryGao ?
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.
The issue you linked is not the same thing as this range, 2063 one is talking about supporting status range from typespec. But this helper is deviring from the logic in HLC: https://github.com/Azure/autorest.typescript/blob/main/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts#L135
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.
yeah, I wonder if that could cause some problem since we are expanding the valid response status code for 2xx?
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 would say that could be a pontential issue but I am not worried about this. The above logic is used in HLC for a long time to check if the response is okay or not, and it works well.
Splitting this into its own PR to help reviewing