Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ea3b08f3
Unverified
Commit
ea3b08f3
authored
Oct 19, 2020
by
Yegor
Committed by
GitHub
Oct 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond to HTTP POST requests with 404 in WebAssetServer (#68492)
* Respond to POST with 404 in WebAssetServer
parent
91a5a1e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+10
-0
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+23
-0
No files found.
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
ea3b08f3
...
...
@@ -333,6 +333,11 @@ class WebAssetServer implements AssetReader {
// handle requests for JavaScript source, dart sources maps, or asset files.
@visibleForTesting
Future
<
shelf
.
Response
>
handleRequest
(
shelf
.
Request
request
)
async
{
if
(
request
.
method
!=
'GET'
)
{
// Assets are served via GET only.
return
shelf
.
Response
.
notFound
(
''
);
}
final
String
requestPath
=
_stripBasePath
(
request
.
url
.
path
,
basePath
);
if
(
requestPath
==
null
)
{
...
...
@@ -969,6 +974,11 @@ class ReleaseAssetServer {
];
Future
<
shelf
.
Response
>
handle
(
shelf
.
Request
request
)
async
{
if
(
request
.
method
!=
'GET'
)
{
// Assets are served via GET only.
return
shelf
.
Response
.
notFound
(
''
);
}
Uri
fileUri
;
final
String
requestPath
=
_stripBasePath
(
request
.
url
.
path
,
basePath
);
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
ea3b08f3
...
...
@@ -32,6 +32,7 @@ const List<int> kTransparentImage = <int>[
void
main
(
)
{
Testbed
testbed
;
WebAssetServer
webAssetServer
;
ReleaseAssetServer
releaseAssetServer
;
Platform
linux
;
PackageConfig
packages
;
Platform
windows
;
...
...
@@ -56,6 +57,14 @@ void main() {
null
,
null
,
);
releaseAssetServer
=
ReleaseAssetServer
(
globals
.
fs
.
file
(
'main.dart'
).
uri
,
fileSystem:
null
,
flutterRoot:
null
,
platform:
null
,
webBuildDirectory:
null
,
basePath:
null
,
);
});
});
...
...
@@ -924,6 +933,20 @@ void main() {
expect
(
webAssetServer
.
defaultResponseHeaders
[
'x-frame-options'
],
null
);
await
webAssetServer
.
dispose
();
});
test
(
'WebAssetServer responds to POST requests with 404 not found'
,
()
=>
testbed
.
run
(()
async
{
final
Response
response
=
await
webAssetServer
.
handleRequest
(
Request
(
'POST'
,
Uri
.
parse
(
'http://foobar/something'
)),
);
expect
(
response
.
statusCode
,
404
);
}));
test
(
'ReleaseAssetServer responds to POST requests with 404 not found'
,
()
=>
testbed
.
run
(()
async
{
final
Response
response
=
await
releaseAssetServer
.
handle
(
Request
(
'POST'
,
Uri
.
parse
(
'http://foobar/something'
)),
);
expect
(
response
.
statusCode
,
404
);
}));
}
class
MockHttpServer
extends
Mock
implements
HttpServer
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment