Skip to content
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

Lychee expects string for accepted status codes #644

Closed
vipulgupta2048 opened this issue Jun 8, 2022 · 13 comments
Closed

Lychee expects string for accepted status codes #644

vipulgupta2048 opened this issue Jun 8, 2022 · 13 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@vipulgupta2048
Copy link

vipulgupta2048 commented Jun 8, 2022

With #636, Lychee add support for parsing status code using v0.10.0 I am getting the error

➜  docs git:(vipul/update-lychee) ✗ lychee --version
lychee 0.10.0
➜  docs git:(vipul/update-lychee) ✗ lychee --config ./lychee.toml "README.md"
Error: invalid type: sequence, expected a string for key `accept` at line 1 column 1

When I am specifying status codes like:

# Comma-separated list of accepted status codes for valid links.
accept = [200, 301, 429]

The error goes away when I specify status codes as string which was the old format. I am trying to read the PR and make a patch for this. I feel like the parse_statuscodes function still expects string but not completely sure how the tests would have been passing then.

@mre
Copy link
Member

mre commented Jun 8, 2022

Latest lychee with these changes wasn't released yet. 😉 It will be part of 0.11.0 since it's a breaking change. For now you need to use a string, yes. I can't remember if the current master still supports a string as an argument, though. If not, we could add that to make it backwards compatible.

@vipulgupta2048
Copy link
Author

Thanks, I should have checked the releases first to make sure if v0.10.0 includes this change or not. My bad. Closing.

@mre
Copy link
Member

mre commented Jun 9, 2022

No worries. 😆

@vipulgupta2048
Copy link
Author

vipulgupta2048 commented Jun 9, 2022

@mre Although I want to ask what is the expected outcome of having an accepted status code. Referring to #634, I have added 429 to accepted status codes, but the report and result still list "Too many network request" errors. Is that expected? Check out my config here balena-io/docs#2317

@mre
Copy link
Member

mre commented Jun 9, 2022

Hum... it should work like you specified it and it should accept 429 as a valid status code. Not sure what's up with that. Can you try to pass --accept 200,204,301,429 in the args? Maybe the config option doesn't get properly merged in.

@mre mre reopened this Jun 9, 2022
@vipulgupta2048
Copy link
Author

That was much better, 429 is being clearly accepted when I ran using the command line arg. Logs show it being green and no 429 in the report @mre

@mre
Copy link
Member

mre commented Jun 9, 2022

Okay then our merging is borked. I think we wanted to switch to https://github.com/mehcode/config-rs for config merging, but I can't remember the crate anymore and I can't find the issue. PRs to fix this are very welcome. I'll keep this open for now.

@mre mre added bug Something isn't working help wanted Extra attention is needed labels Jun 29, 2022
@mre
Copy link
Member

mre commented Aug 12, 2022

@vipulgupta2048 can you test the latest master? I tested it locally and it merging works as expected for me. (In my test I overwrote the accepted status code by using a custom config file and it worked.)

@mre
Copy link
Member

mre commented Aug 12, 2022

My config:

# Comma-separated list of accepted status codes for valid links.
accept = [200, 429]

@mre
Copy link
Member

mre commented Aug 12, 2022

For the record, we could move to config-rs once clap is supported (rust-cli/config-rs#328)

@vipulgupta2048
Copy link
Author

Thanks @mre, I was out on vacation so couldn't act on this. I tried building master v0.10.1, tested and it works as expected. Made a PR to get this change merged. Closing the issue.

@vipulgupta2048
Copy link
Author

Hey @mre can you release a new patch of the lychee action? Having v0.10.1 inside?

@tooomm
Copy link
Contributor

tooomm commented Sep 4, 2022

Hey @mre can you release a new patch of the lychee action? Having v0.10.1 inside?

@vipulgupta2048 lychee v0.10.1 is already the default since lychee-action v1.5.1 (released a few weeks ago).
It looks like you're using that already in your PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants