-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from fortizpenaloza/fix-redirect
Fix redirect to index file
- Loading branch information
Showing
7 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-HTTP-Examples.package/ZnStaticFileServerDelegate.class/instance/directoryRedirectFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
private | ||
directoryRedirectFor: uri | ||
| directoryUri | | ||
directoryUri := uri copy addPathSegment: #/. | ||
directoryUri := uri copy addPathSegment: $/. | ||
^ ZnResponse redirect: directoryUri |
7 changes: 7 additions & 0 deletions
7
...ory/Zinc-HTTP-Examples.package/ZnStaticFileServerDelegateTest.class/instance/indexHtml.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
private | ||
indexHtml | ||
^ '<html> | ||
<head><title>Index</title></head> | ||
<body><h1>Hi, i''m the index page</h1></body> | ||
</html> | ||
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../Zinc-HTTP-Examples.package/ZnStaticFileServerDelegateTest.class/instance/testRedirect.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tests | ||
testRedirect | ||
self | ||
withServerDo: [ :server | | ||
| client | | ||
(client := ZnClient new) | ||
beOneShot; | ||
url: server localUrl; | ||
addPath: #('local-files'); | ||
get. | ||
self assert: client isSuccess. | ||
self assert: client response contentType equals: ZnMimeType textHtml. | ||
self assert: client contents equals: self indexHtml. | ||
self assert: (ZnUtils parseHttpDate: (client response headers at: 'Modification-Date')) equals: (ZnFileSystemUtils modificationTimeFor: 'index.html') asUTC. | ||
self assert: (ZnUtils parseHttpDate: (client response headers at: 'Expires')) > (DateAndTime now + 10 days). | ||
self assert: (client response headers at: 'Cache-Control') equals: (server delegate maxAgeFor: ZnMimeType textHtml) ] |
2 changes: 1 addition & 1 deletion
2
repository/Zinc-HTTP-Examples.package/ZnStaticFileServerDelegateTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters