Fix #221
This commit is contained in:
parent
d13c5f979e
commit
4ad6846802
2 changed files with 6 additions and 3 deletions
|
@ -94,11 +94,12 @@ class UserActionWorker(private val context: Context, params: WorkerParameters) :
|
|||
save(action.copy(progress = ACTION_PROGRESS_ONGOING, error = null))
|
||||
|
||||
val url = action.url ?: return
|
||||
val method = action.method ?: "POST" // (not GET, because POST as a default makes more sense!)
|
||||
val body = action.body ?: ""
|
||||
val method = action.method ?: DEFAULT_HTTP_ACTION_METHOD
|
||||
val defaultBody = if (listOf("GET", "HEAD").contains(method)) null else ""
|
||||
val body = action.body ?: defaultBody
|
||||
val builder = Request.Builder()
|
||||
.url(url)
|
||||
.method(method, body.toRequestBody())
|
||||
.method(method, body?.toRequestBody())
|
||||
.addHeader("User-Agent", ApiService.USER_AGENT)
|
||||
action.headers?.forEach { (key, value) ->
|
||||
builder.addHeader(key, value)
|
||||
|
@ -134,6 +135,7 @@ class UserActionWorker(private val context: Context, params: WorkerParameters) :
|
|||
const val INPUT_DATA_NOTIFICATION_ID = "notificationId"
|
||||
const val INPUT_DATA_ACTION_ID = "actionId"
|
||||
|
||||
private const val DEFAULT_HTTP_ACTION_METHOD = "POST" // Cannot be changed without changing the contract
|
||||
private const val TAG = "NtfyUserActWrk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ Bugs:
|
|||
* Validate URLs when changing default server and server in user management (#193, thanks to @StoyanDimitrov for reporting)
|
||||
* Error in sending test notification in different languages (#209, thanks to @StoyanDimitrov for reporting)
|
||||
* "[x] Instant delivery in doze mode" checkbox does not work properly (#211)
|
||||
* Disallow "http" GET/HEAD actions with body (#221, thanks to @cmeis for reporting)
|
||||
|
||||
Additional translations:
|
||||
* Japanese (thanks to @shak)
|
||||
|
|
Loading…
Reference in a new issue