Skip to content
Snippets Groups Projects
Commit d3c96b19 authored by thaihoangdang's avatar thaihoangdang
Browse files

Done with PUT

parent 39eb96e1
No related branches found
No related tags found
1 merge request!22Http request
Pipeline #89246 failed
package notes.multi.utilities
import com.beust.klaxon.Klaxon
import com.beust.klaxon.json
import java.net.URI
import java.net.URL
import java.net.http.HttpClient
......@@ -39,9 +40,11 @@ class HttpOperations {
val tempNote = RemoteNote(note.id, note.title, note.text.toString(), note.dateCreated, note.lastModified)
val jsonNote = Klaxon().toJsonString(tempNote)
println(jsonNote)
val client = HttpClient.newBuilder().build()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8080/notes/"))
.uri(URI.create("http://localhost:8080/notes/${tempNote.id}"))
.header("Content-Type", "application/json")
.PUT(HttpRequest.BodyPublishers.ofString(jsonNote))
.build()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment