Skip to content

Commit 8706830

Browse files
mtb0x1ivanitskiy
authored andcommitted
fix(#50): user_agent method returns 'Option<&NgxStr>' and not '&NgxStr'
1 parent 89e0fcc commit 8706830

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/curl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ http_request_handler!(curl_access_handler, |request: &mut http::Request| {
111111

112112
match co.enable {
113113
true => {
114-
if request.user_agent().as_bytes().starts_with(b"curl") {
114+
if request.user_agent().is_some_and(|ua| ua.as_bytes().starts_with(b"curl")) {
115115
http::HTTPStatus::FORBIDDEN.into()
116116
} else {
117117
core::Status::NGX_DECLINED

0 commit comments

Comments
 (0)