mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 08:47:03 +05:30
fix(api): fix AvoidUsingNotNullOperator
lint
This commit is contained in:
parent
c72ba1ab97
commit
62ac78bad6
2 changed files with 8 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2023 Harsh Shandilya.
|
* Copyright © 2023-2024 Harsh Shandilya.
|
||||||
* Use of this source code is governed by an MIT-style
|
* Use of this source code is governed by an MIT-style
|
||||||
* license that can be found in the LICENSE file or at
|
* license that can be found in the LICENSE file or at
|
||||||
* https://opensource.org/licenses/MIT.
|
* https://opensource.org/licenses/MIT.
|
||||||
|
@ -19,8 +19,9 @@ object CSRFTokenConverter : Converter<ResponseBody, CSRFToken> {
|
||||||
val token =
|
val token =
|
||||||
Jsoup.parse(value.string(), LobstersApi.BASE_URL)
|
Jsoup.parse(value.string(), LobstersApi.BASE_URL)
|
||||||
.select("meta[name=\"csrf-token\"]")
|
.select("meta[name=\"csrf-token\"]")
|
||||||
.first()!!
|
.firstOrNull()
|
||||||
.attr("content")
|
?.attr("content")
|
||||||
|
.orEmpty()
|
||||||
return CSRFToken(token)
|
return CSRFToken(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2021-2023 Harsh Shandilya.
|
* Copyright © 2021-2024 Harsh Shandilya.
|
||||||
* Use of this source code is governed by an MIT-style
|
* Use of this source code is governed by an MIT-style
|
||||||
* license that can be found in the LICENSE file or at
|
* license that can be found in the LICENSE file or at
|
||||||
* https://opensource.org/licenses/MIT.
|
* https://opensource.org/licenses/MIT.
|
||||||
|
@ -15,7 +15,9 @@ import kotlin.contracts.contract
|
||||||
object TestUtils {
|
object TestUtils {
|
||||||
fun getResource(path: String): String {
|
fun getResource(path: String): String {
|
||||||
// Load the JSON response
|
// Load the JSON response
|
||||||
val uri = javaClass.classLoader!!.getResource(path)
|
val uri =
|
||||||
|
requireNotNull(javaClass.classLoader) { "if this is null something has gone very wrong" }
|
||||||
|
.getResource(path)
|
||||||
val file = File(uri.path)
|
val file = File(uri.path)
|
||||||
return String(file.readBytes())
|
return String(file.readBytes())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue