File tree Expand file tree Collapse file tree 4 files changed +44
-126
lines changed Expand file tree Collapse file tree 4 files changed +44
-126
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ name: Test
9
9
jobs :
10
10
build_and_test :
11
11
name : Test
12
- runs-on : ubuntu-latest
12
+ runs-on : ubuntu-22.04
13
13
steps :
14
- - uses : actions/checkout@v2
14
+ - uses : actions/checkout@v3
15
15
16
16
- name : ACTIONS_ALLOW_UNSECURE_COMMANDS
17
17
id : ACTIONS_ALLOW_UNSECURE_COMMANDS
20
20
- name : add cr
21
21
run : |
22
22
mkdir -p $GITHUB_WORKSPACE/bin
23
- wget -O $GITHUB_WORKSPACE/bin/cr https://github.com/calcit-lang/calcit/releases/download/0.6.1 /cr
23
+ wget -O $GITHUB_WORKSPACE/bin/cr https://github.com/calcit-lang/calcit/releases/download/0.6.19 /cr
24
24
chmod +x $GITHUB_WORKSPACE/bin/cr
25
25
echo "::add-path::$GITHUB_WORKSPACE/bin"
26
26
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " calcit_http"
3
- version = " 0.0.8 "
3
+ version = " 0.0.9 "
4
4
authors = [
" jiyinyiyong <[email protected] >" ]
5
- edition = " 2018 "
5
+ edition = " 2021 "
6
6
7
7
[lib ]
8
8
name = " calcit_http"
@@ -13,6 +13,7 @@ crate-type = ["dylib"] # Creates dynamic lib
13
13
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
14
14
15
15
[dependencies ]
16
- cirru_edn = " 0.2.15"
17
- cirru_parser = " 0.1.18"
18
- tiny_http = " 0.11.0"
16
+ cirru_edn = " 0.2.21"
17
+ cirru_parser = " 0.1.24"
18
+ tiny_http = " 0.12.0"
19
+ querystring = " 1.1.0"
Original file line number Diff line number Diff line change @@ -42,7 +42,26 @@ pub fn serve_http(
42
42
43
43
let mut m: HashMap < Edn , Edn > = HashMap :: new ( ) ;
44
44
m. insert ( Edn :: kwd ( "method" ) , Edn :: kwd ( & request. method ( ) . to_string ( ) ) ) ;
45
- m. insert ( Edn :: kwd ( "url" ) , Edn :: str ( request. url ( ) . to_string ( ) ) ) ;
45
+ let url = request. url ( ) . to_string ( ) ;
46
+ m. insert ( Edn :: kwd ( "url" ) , Edn :: str ( url. to_owned ( ) ) ) ;
47
+
48
+ match url. split_once ( '?' ) {
49
+ Some ( ( path_part, query_part) ) => {
50
+ m. insert ( Edn :: kwd ( "path" ) , path_part. into ( ) ) ;
51
+ m. insert ( Edn :: kwd ( "querystring" ) , query_part. into ( ) ) ;
52
+ let query = querystring:: querify ( query_part) ;
53
+ let mut query_dict = HashMap :: new ( ) ;
54
+ for ( k, v) in query {
55
+ query_dict. insert ( Edn :: kwd ( k) , v. into ( ) ) ;
56
+ }
57
+ m. insert ( Edn :: kwd ( "query" ) , Edn :: Map ( query_dict) ) ;
58
+ }
59
+ None => {
60
+ m. insert ( Edn :: kwd ( "path" ) , url. into ( ) ) ;
61
+ m. insert ( Edn :: kwd ( "querystring" ) , "" . into ( ) ) ;
62
+ m. insert ( Edn :: kwd ( "query" ) , Edn :: Map ( HashMap :: new ( ) ) ) ;
63
+ }
64
+ }
46
65
47
66
let mut headers: HashMap < Edn , Edn > = HashMap :: new ( ) ;
48
67
You can’t perform that action at this time.
0 commit comments