Skip to content

Commit

Permalink
fix(#50): user_agent method returns 'Option<&NgxStr>' and not '&NgxStr'
Browse files Browse the repository at this point in the history
  • Loading branch information
mtb0x1 authored and ivanitskiy committed Oct 26, 2023
1 parent 89e0fcc commit 8706830
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ http_request_handler!(curl_access_handler, |request: &mut http::Request| {

match co.enable {
true => {
if request.user_agent().as_bytes().starts_with(b"curl") {
if request.user_agent().is_some_and(|ua| ua.as_bytes().starts_with(b"curl")) {
http::HTTPStatus::FORBIDDEN.into()
} else {
core::Status::NGX_DECLINED
Expand Down

0 comments on commit 8706830

Please sign in to comment.