This file contains hidden or 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
class CurlInterceptor extends Interceptor { | |
@override | |
void onRequest(RequestOptions options, RequestInterceptorHandler handler) { | |
try { | |
final qp = options.queryParameters; | |
final h = options.headers; | |
final d = options.data; | |
final curl = | |
'curl -X ${options.method} \'${options.baseUrl}${options.path}' + | |
(qp.length != 0 ? qp.keys.fold('', (value, key) => '$value${value.length == 0 ? '?' : '&'}$key=${qp[key]}\'') : '\'') + |
This file contains hidden or 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
/** | |
Usage for extensions. | |
Initialize Moshi in your Converter class | |
*/ | |
private val moshi: Moshi = Moshi.Builder() | |
.add(KotlinJsonAdapterFactory()) | |
.build() | |
/** | |
* [Moshi] extension to transform a [List] to Json |
OlderNewer