New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for HttpPostContext content-type #140
Add tests for HttpPostContext content-type #140
Conversation
I try to run below test code, but failed.
Can I fix production code (below |
Hi @doyaaaaaken ! Thanks for your contribution. I’ll be able to handle this PR in 10 days. |
|
||
1. Form or Json in body : ```kotlin ... body() { json { ... } } ...``` | ||
2. Custom body type : ```kotlin ... body(myContentType) { ... } ...``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you should mention about kotlin header{ "Content-type" to type }
way.
About it I wrote some info in pull request comments.
src/test/kotlin/io/github/rybalkinsd/kohttp/dsl/context/HttpPostContextTest.kt
Show resolved
Hide resolved
Hello, @doyaaaaaken ! Question about setting Content-type with So, if body was set and Content-type is not null, request will use Content-type from body and will ignore header You can also check it through postman-echo public api: httpPost {
url("https://postman-echo.com/post")
header { "Content-Type" to "application/json; charset=utf-8" }
body { form("content") }
}.use {
// will print json with form Content-Type in it
print(it.body()?.string())
} So, its very good that you tested HttpPostContext for setting contentType in body. |
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=========================================
Coverage 90.59% 90.59%
Complexity 120 120
=========================================
Files 40 40
Lines 372 372
Branches 45 45
=========================================
Hits 337 337
Misses 9 9
Partials 26 26 Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=========================================
Coverage 90.59% 90.59%
Complexity 120 120
=========================================
Files 40 40
Lines 372 372
Branches 45 45
=========================================
Hits 337 337
Misses 9 9
Partials 26 26 Continue to review full report at Codecov.
|
@DeviantBadge |
Great! |
Hello, I try to resolve #62 , but I can't do to the last.
Because, this comment's ( #62 (comment) ) 1st way (
header { type }
) seems not to work.So, at first I try to implement 2nd and 3rd way's test.