micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).
MIT License
2.65k stars 143 forks source link

Parse redirection correctly and accept HTTP 1.0 response #5

Closed angerman closed 15 years ago

angerman commented 15 years ago

Here is a very quick fix to make resty accept HTTP 1.0 responses too and make it deal correctly with redirections. (always take the last response code.) Turn

    |sed '/^.*HTTP\/1\.1 [0-9][0-9][0-9]/s/.*\([0-9]\)[0-9][0-9].*/\1/p; d')

into

    |sed '/^.*HTTP\/1\.[01] [0-9][0-9][0-9]/s/.*\([0-9]\)[0-9][0-9].*/\1/p; d' | tail -n1)
micha commented 15 years ago

Awesome, thanks! Much better now. Patch applied.