Skip to content

Commit e349088

Browse files
authored
Merge pull request #38 from matemaciek/patch-1
Auto-serve `index.html` for root path
2 parents c831aaf + 9808f15 commit e349088

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_httpserver/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ def poll(self):
169169

170170
# If no handler exists and request method is GET, try to serve a file.
171171
elif handler is None and request.method == HTTPMethod.GET:
172+
filename = "index.html" if request.path == "/" else request.path
172173
HTTPResponse(request).send_file(
173-
filename=request.path,
174+
filename=filename,
174175
root_path=self.root_path,
175176
)
176177
else:

0 commit comments

Comments
 (0)