You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Java/Feigh] Don't HTML escape Accept / Content-Type header
When e.g. the Accept-Header contains special characters such as `=`, mustache escapes them, which results in code like this to be generated:
```java
// MyApi.java
public interface MyApi extends ApiClient.Api {
@RequestLine("GET /rest/protected/items?size={size}&page={page}")
@headers({
"Content-Type: */*",
"Accept: application/com.example+json; version=1.0; charset=utf-8,application/com.example+xml; version=1.0; charset=utf-8,application/json; charset=utf-8,application/xml; charset=utf-8",
})
LicenseListResource getLicenses(@QueryMap(encoded=true) Map<String, Object> queryParams);
}
```
Note the `Accept: application/com.example+json; version=1.0; charset=utf-8` with the escaped `=`, which does not work. This disables HTML escaping for the header values.
On a side note though, I had been wondering whether HTML escaping makes sense when generating Java files? It does in JavaDocs I suppose, but shouldn't it be disabled everywhere else?
0 commit comments