Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Commits
661b559d
Commit
661b559d
authored
11 months ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
fix: url param handling
parent
a9c1170b
No related branches found
No related tags found
1 merge request
!10
Clhp map
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/server_requests/fetch_markers.dart
+3
-1
3 additions, 1 deletion
app/lib/server_requests/fetch_markers.dart
app/lib/server_requests/fetch_relation.dart
+5
-1
5 additions, 1 deletion
app/lib/server_requests/fetch_relation.dart
server/main.py
+4
-2
4 additions, 2 deletions
server/main.py
with
12 additions
and
4 deletions
app/lib/server_requests/fetch_markers.dart
+
3
−
1
View file @
661b559d
...
...
@@ -23,7 +23,9 @@ Future<FetchResult> fetchMeasurements() async {
(
X509Certificate
cert
,
String
host
,
int
port
)
=
>
true
;
// Request markers from server
var
request
=
await
client
.
getUrl
(
Uri
.
parse
(
serverURI
+
mapEndpoint
));
var
parameterValue
=
'Mjosa'
;
// NB temp hardcoded, should use selectedLake directly in url param
var
request
=
await
client
.
getUrl
(
Uri
.
parse
(
'
$serverURI$mapEndpoint
?lake='
'
${Uri.encodeComponent(parameterValue)}
'
));
var
response
=
await
request
.
close
();
// Close response body at end of function
// Parse body to JSON if request is ok
...
...
This diff is collapsed.
Click to expand it.
app/lib/server_requests/fetch_relation.dart
+
5
−
1
View file @
661b559d
...
...
@@ -15,7 +15,11 @@ Future<Uint8List> fetchRelation() async {
(
X509Certificate
cert
,
String
host
,
int
port
)
=
>
true
;
// Execute request to to get_relation endpoint
var
request
=
await
client
.
getUrl
(
Uri
.
parse
(
'
${serverURI}
get_relation'
));
var
parameterValue
=
'Mjosa'
;
// NB temp hardcoded, should use selectedLake directly in url param
//var request = await client.getUrl(Uri.parse('${serverURI}get_relation'));
var
request
=
await
client
.
getUrl
(
Uri
.
parse
(
'
${serverURI}
get_relation?lake='
'
${Uri.encodeComponent(parameterValue)}
'
));
var
response
=
await
request
.
close
();
// Close response body at end of function
// Try to parse body to JSON if request is ok
...
...
This diff is collapsed.
Click to expand it.
server/main.py
+
4
−
2
View file @
661b559d
...
...
@@ -24,11 +24,13 @@ class IceHTTPServer(HTTPServer):
# Custom HTTP class
class
IceHTTP
(
BaseHTTPRequestHandler
):
def
__init__
(
self
,
request
,
client_address
,
server
):
self
.
cursor
=
server
.
cursor
super
().
__init__
(
request
,
client_address
,
server
)
def
do_GET
(
self
):
# Root path
if
self
.
path
==
'
/
'
:
# NB: temporary root path behavior
self
.
send_response
(
200
)
...
...
@@ -37,12 +39,12 @@ class IceHTTP(BaseHTTPRequestHandler):
self
.
wfile
.
write
(
b
"
Root path hit!
"
)
elif
self
.
path
==
'
/update_map
'
:
# NB: should be POST?
elif
self
.
path
.
startswith
(
'
/update_map
'
)
:
# NB: should be POST?
parsed_path
=
urlparse
(
self
.
path
)
query_params
=
parse_qs
(
parsed_path
.
query
)
get_all_markers
(
self
,
self
.
cursor
,
'
mjosa
'
)
# Get all markers
# NB: temporary hardcoded waterBodyName
elif
self
.
path
==
'
/get_relation
'
:
elif
self
.
path
.
startswith
(
'
/get_relation
'
)
:
parsed_path
=
urlparse
(
self
.
path
)
query_params
=
parse_qs
(
parsed_path
.
query
)
fetch_divided_map
(
self
,
'
Mjosa
'
)
# NB temp hardcoded value
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment