Skip to content

Commit 8f6934c

Browse files
committed
[0.10.0]
README.md improved
1 parent c0eb522 commit 8f6934c

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ Library provides *MediaType* class for correctly parsing and interpreting MediaT
5757
There are plenty of widely used and preconfigured MediaTypes.
5858

5959
```java
60-
MediaType jsonType = MediaType.APPLICATION_JSON_UTF_8_TYPE;
60+
MediaType jsonMediaTypeUtf8 = MediaType.APPLICATION_JSON_UTF_8_TYPE;
6161

62-
MediaType type1 = MediaType.of("application/json");
62+
MediaType mediaType = MediaType.of("application/json");
6363

64-
Optional<MediaType> type2 = MediaType.ofExtension("json");
64+
Optional<MediaType> jsonMediaType = MediaType.ofExtension("json");
6565
```
6666

6767
## URIBuilder
@@ -80,17 +80,30 @@ URIBuilder.of("https://api.etherscan.io").path("/api")
8080
Describes HTTP headers and can be instantiated via different builders available.
8181

8282
```java
83-
final Map<String, List<String>> h = new HashMap<>();
84-
h.put(HttpHeaders.CONNECTION, List.of("keep-alive"));
85-
h.put(HttpHeaders.CONTENT_LENGTH, List.of("72"));
86-
h.put(HttpHeaders.CONTENT_TYPE, List.of("application/json"));
83+
final Map<String, List<String>> headerMap = new HashMap<>();
84+
headerMap.put(HttpHeaders.CONNECTION, List.of("keep-alive"));
85+
headerMap.put(HttpHeaders.CONTENT_LENGTH, List.of("72"));
86+
headerMap.put(HttpHeaders.CONTENT_TYPE, List.of("application/json"));
8787

88-
final HttpHeaders headers = HttpHeaders.ofMultiMap(h);
88+
final HttpHeaders headers = HttpHeaders.ofMultiMap(headerMap);
8989

9090
final Optional<Long> contentLength = headers.contentLength();
9191
final Optional<MediaType> mediaType = headers.contentType();
9292
```
9393

94+
## FormattedException
95+
96+
Exception that allow to format messages like SLF4J logger and other similar.
97+
98+
```java
99+
throw new FormattedException("Failed for {} with code {}", "Bob", 200);
100+
```
101+
102+
Resulted exception message:
103+
```text
104+
Failed for Bob with code 200
105+
```
106+
94107
## License
95108

96109
This project licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details

0 commit comments

Comments
 (0)