* Fix no response logging on async Feign.
Copy log level onto asyncBuilder as well as setting it on the builder, so responses get logged in the asynchronous case.
* Forgot a semicolon
* Run license:format; make logLevel not final.
Co-authored-by: Andrew Winterman <andrew.winterman@altruist.com>
* Modify DefaultMethodHandler to work with Android.
* Modified to work with Android. Previous commit worked up to API level 28 (Android 8) however, Android 9+ enforces more strict checking with reflection.
* Add support for java 9
* Move multi-release to java 9 only
* Have a single DefaultMethodHandle for java 8 and 11 that don't print warnings
* Bump spring version
Co-authored-by: Clayton Walker <cwalker@sofi.org>
Co-authored-by: Marvin Froeder <marvin.froeder@dovetailstudios.com>
* Make the FieldQueryMapEncoder encoder thread safe
Change the caching map to be concurrent and only
insert items that are missing to the map.
Fixes#1257
* Refactor the FieldQueryMapEncoder to use streams
Fixes#1257
* Fix bug for FeignException cannot get the correct charset (#1325)
* Add test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Add more test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Format test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Fix bug for FeignException cannot get the correct charset (#1325)
* Add test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Add more test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Format test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Add test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Add more test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Format test for (Fix bug for FeignException cannot get the correct charset) (#1325)
* Correcting License Headers for 2021
Co-authored-by: Kevin Davis <kdavisk6@gmail.com>
* If charset is set in Content-type, we decode response using that charset
* Java 8 compatibility
* Format fix
* Moving code to get charset to Response in order to be used by another
decoders
Fixes: #934, #1208
This change updates the Input Stream handling when using the Default
client implementation to detect when a response is `gzipped` and
wrap it in a `GZipInputStream`.
This addresses any issues related to compression when using the
default client.
In addition, removed the implicit parsing of the
body during toString. This was also brought up in #1208 and it came up
during testing of this change. Users should be using our `asReader`
and other methods to access the response body.
* Adding Deflate support
* Added Deflate Support and removed implicit response body reading
* Refactored Gzip and Deflate Conditions
* Corrected formatting and line-endings
Fixes: #1270
`HeaderTemplate` was confusing iterable values with literal values due
to the presence of comma `,` characters in the result. The result was
that, in certain cases like HTTP Dates, additional spaces were inserted
into the final expanded value.
The root cause of the issue is that `HeaderTemplate` combined all values
into a single `String` template, with each value separated by a comma.
This change refactors `HeaderTemplate` to treat all `values` as individual
`Templates`, removing the need to combine any provided values into a single
String.
* Remove unnecessary string splits when expanding Headers in RequestTemplate
JEP 118 introduced javac option `-parameters` that adds to bytecode
method parameter names, so if code is compiled with that option
and @Param value is empty we can get that template parameter name
from method parameter name.
Fixes#1297.
* Add unit test illustrating #1217
* Make sure content-type is limited to a single value
Co-authored-by: Pierre de Soyres <pierre.de-soyres@eptica.com>
This change converts the Java11 module release into two steps:
1. run `mvn install` for just feign-java11 to ensure the dependent
projects exist in the local repo
2. run `mvn deploy` for `feign-java11`
The result should be that only the single module is deployed
* Correcting License Headers
* Add list tests to QueryTemplateTest
* Make expandIterable() return empty string if unresolved
* Rename new tests to fit existing tests
* Format code
* Fix newlines
Fixes#1172
When a `HeaderTemplate` is expanded, the result is placed onto a new
`RequestTemplate` via it's `header` method. This results in the expanded
result being turned back into a `HeaderTemplate`, simply out of
convenience. This behavior, while fine more general use cases, is
problematic if the header value contains braces `{` `}`, as this will
cause the app to consider these values as new expressions.
At this point in the expansion process, there is no need to evaluate
the expanded values again, so this change allows a `Template` to be
created from an existing List of `TemplateChunks`, allowing for callers
to provide explicit `Literal` or `Expression` chunks directly into a
`Template`, by passing the template parsing algorithms.
`RequestTemplate#expand` has been updated to apply this logic for
`HeaderTemplate` values only.
* Configurable to disable streaming mode for Default client
* Add a property `allowStramingMode` in `Request.Option`.
* Optional to disable the streaming mode for `HttpURLConnection`.
* The property is default to `true` for compatibility.
Fix#260
* Fix a merging problem
* Make the new option `disableRequestBuffering` to Default client
* Move it from `Request.Options` to `Default` client
Fixes#1163
Restores `Request.Body.encoded` static function and
`RequestTemplate.requestBody` to restore compatibility.
Additionally, mark it as deprecated to encourage usage of
`RequestTemplate.body`.
`Request.Body` is an internal abstraction that was made built
in an effort to better manage request body data. It was made
public too early and will be reverted back to it's internal
state in future releases.
Fixes#1156
Collection Format was encoding query string values unnecessarily
due to changes introduced in #1138 and #1139 that encode template
values before appending them to the query string.
In addition, `decodeSlash` flags that were accidentally removed,
have been restored in QueryTemplate.
* Restoring decodeSlash in QueryTemplate
* Correcting Readme with regards to decodeSlash usage
Fixes#857
To simply removal, Request.Body was returned back to an internal
component and additional methods were added to Request to expose
it's capabilities outside of the object.
All other deprecated usage in core modules has been removed.
Deprecated code still exists in the test cases and will be
removed once the deprecated methods are removed in our next
major release.
Fixes#920
FeignException may contain the data from the response if the response is available and contains data. However, the method `content` is ambiguious and does not reveal it's intent. User's have expressed confusion as to if it is for the Request or the Response.
This change adds a new method `responseBody` to addresse this. Use of content is now `@deprecated`.
Relates to #561
Corrects inconsistent processing during Contract parsing with `formParams` are mixed with `@Body` parameters where order of parameters mattered, when it shouldn't.
Test Case:
```java
@RequestLine("POST /")
void formParamAndBodyParams(
@Param("customer_name") String customer,
String body);
@RequestLine("POST /")
void bodyParamsAndformParam(
String body,
@Param("customer_name") String customer);
```
Fixes#1089
Query Template names, which also happen to be templates, were not being
considered when listing out all of the variable names in a Query Template.
* Ensure Iterable values are encoded before template expansion
Fixes#1123, Fixes#1133, Fixes#1102, Fixes#1028
Ensures that all expressions are fully-encoded before being
manipulated during template expansion. This allows parameters
to include reserved values and result in properly encoded
results.
Additionally, `Iterable` values are now handled in accordance
with RFC 6570 allowing for the specified `CollectionFormat` to
be applied and empty parameters to be expanded correctly as this
is the main use case that exhibited this issue.
Fixes#1036
Relaxed the regular expression used to determine if an expression
is valid to support additional expression variable names. We will
no longer restrict what an expression name can be.
* Ensure all brackets are decoded in JSON based Body Templates
Fixes#1129
When JSON is detected in a Body Template, all start and end tokens
that may have been pct-encoded are decoded, ensuring that the
expanded result is valid JSON.
* Expose Method and Target on RequestTemplate
* Add test to check if method metadata is present
* Annotated API changes as being experimental/not API-frozen
* The method parseAndValidatateMetadata has been deleted and parseAndValidateMetadata is used instead;
* Replaced all usages along the project;
* Documented which method to use instead of the deleted one.
Signed-off-by: Cézar Augusto <cezar@stilingue.com.br>
* Move DeclarativeContract to new file
* Get spring4 contract to compile with feign10
* Move to declarative contract
* Brought spring 4 contract back to life
* Remove old badges
* Throw error when contract mark a method as ignored
* Declarative contracts
* Actually using the data structure to read declaritve contracts
* Using declarative contract for jaxrs contracts
* Make possible for contracts to declare parameters as ignored
* Using predicate to decide if an AnnotationProcessor should be invoked
* Restore environment variable for GITHUB_TOKEN
* Use travis to enforce code format
* Use travis to enforce that should be no local changes after build
* Seems hard to break a build on travis
* Format code
* Create log files on temp dir
Fixes#985
* JavaLogger(String name) added. Workaround for JavaLogger() provided
* JavaLogger() marked as deprecated. Workaround for JavaLogger() removed
* Little fix for note in README
* One more little fix for note in README
* JavaLogger(Class<?>) constructor added
Fixes#845
This change allows Feign Exceptions to be created with the original request as an optional parameter.
Changes include:
* Request field added to FeignException
* New constructors are defended from null in request argument
* Tests to check null instead of request, null message updated