GeezerVison is showing github.com — Support OPTIONS requests. (#52) · WebThingsIO/webthing-java@74cc3ac
File treeExpand file treeCollapse file tree Open diff view settings src/main/java/org/mozilla/iot/webthing
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/build.yml +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,12 +20,13 @@ jobs: | 20 | 20 | '11.0.x', | 21 | 21 | '12.0.x', | 22 | 22 | '13.0.x', | | 23 | + '14.0.x', | 23 | 24 | ] | 24 | 25 | steps: | 25 | 26 | - uses: actions/checkout@v1 | 26 | 27 | - uses: actions/setup-python@v1 | 27 | 28 | with: | 28 | | - python-version: '3.7' | | 29 | + python-version: '3.8' | 29 | 30 | - uses: actions/setup-java@v1 | 30 | 31 | with: | 31 | 32 | java-version: ${{ matrix.java-version }} | |
Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +6-1Lines changed: 6 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 |
| 3 | 3 | ## [Unreleased] | 4 | 4 |
| | 5 | +## [0.12.1] - 2020-03-27 | | 6 | +### Added | | 7 | +- Support OPTIONS requests to allow for CORS. | | 8 | + | 5 | 9 | ## [0.12.0] - 2019-07-12 | 6 | 10 | ### Changed | 7 | 11 | - Things now use `title` rather than `name`. | | 20 | 24 | ### Changed | 21 | 25 | - Property, Action, and Event description now use `links` rather than `href`. - [Spec PR](https://github.com/mozilla-iot/wot/pull/119) | 22 | 26 |
| 23 | | -[Unreleased]: https://github.com/mozilla-iot/webthing-java/compare/v0.12.0...HEAD | | 27 | +[Unreleased]: https://github.com/mozilla-iot/webthing-java/compare/v0.12.1...HEAD | | 28 | +[0.12.1]: https://github.com/mozilla-iot/webthing-java/compare/v0.12.0...v0.12.1 | 24 | 29 | [0.12.0]: https://github.com/mozilla-iot/webthing-java/compare/v0.11.0...v0.12.0 | 25 | 30 | [0.11.0]: https://github.com/mozilla-iot/webthing-java/compare/v0.10.0...v0.11.0 | 26 | 31 | [0.10.0]: https://github.com/mozilla-iot/webthing-java/compare/v0.9.1...v0.10.0 |
Collapse file Copy file name to clipboardExpand all lines: pom.xml +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 |
| 7 | 7 | <groupId>org.mozilla.iot</groupId> | 8 | 8 | <artifactId>webthing</artifactId> | 9 | | - <version>0.12.0</version> | | 9 | + <version>0.12.1</version> | 10 | 10 |
| 11 | 11 | <name>WebThing</name> | 12 | 12 | <description>Implementation of an HTTP Web Thing.</description> | | 73 | 73 | <dependency> | 74 | 74 | <groupId>org.json</groupId> | 75 | 75 | <artifactId>json</artifactId> | 76 | | - <version>20180813</version> | | 76 | + <version>20190722</version> | 77 | 77 | </dependency> | 78 | 78 | <dependency> | 79 | 79 | <groupId>org.nanohttpd</groupId> | | 98 | 98 | <dependency> | 99 | 99 | <groupId>com.github.everit-org.json-schema</groupId> | 100 | 100 | <artifactId>org.everit.json.schema</artifactId> | 101 | | - <version>1.11.1</version> | | 101 | + <version>1.12.1</version> | 102 | 102 | </dependency> | 103 | 103 | <dependency> | 104 | 104 | <groupId>junit</groupId> | |
Collapse file Copy file name to clipboardExpand all lines: src/main/java/org/mozilla/iot/webthing/WebThingServer.java +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -510,6 +510,12 @@ public Response other(String method, | 510 | 510 | UriResource uriResource, | 511 | 511 | Map<String, String> urlParams, | 512 | 512 | IHTTPSession session) { | | 513 | + if (method.equals("OPTIONS")) { | | 514 | + return corsResponse(NanoHTTPD.newFixedLengthResponse(Response.Status.NO_CONTENT, | | 515 | + null, | | 516 | + null)); | | 517 | + } | | 518 | + | 513 | 519 | return corsResponse(NanoHTTPD.newFixedLengthResponse(Response.Status.METHOD_NOT_ALLOWED, | 514 | 520 | null, | 515 | 521 | null)); | @@ -757,7 +763,7 @@ public void run() { | 757 | 763 | link.put("rel", "alternate"); | 758 | 764 | link.put("href", wsHref); | 759 | 765 | description.getJSONArray("links").put(link); | 760 | | - | | 766 | + | 761 | 767 | String base = String.format("%s://%s%s", | 762 | 768 | this.isSecure(uriResource) ? | 763 | 769 | "https" : | |
|