fix: added leading slashes to api endpoints
parent
eff2072fdc
commit
2d5b071099
|
@ -110,7 +110,7 @@ pub fn (mut d DockerConn) container_create(c NewContainer) ?CreatedContainer {
|
||||||
|
|
||||||
// start_container starts the container with the given id.
|
// start_container starts the container with the given id.
|
||||||
pub fn (mut d DockerConn) container_start(id string) ? {
|
pub fn (mut d DockerConn) container_start(id string) ? {
|
||||||
d.send_request(Method.post, 'containers/$id/start')?
|
d.send_request(Method.post, '/containers/$id/start')?
|
||||||
head, body := d.read_response()?
|
head, body := d.read_response()?
|
||||||
|
|
||||||
if head.status_code != 204 {
|
if head.status_code != 204 {
|
||||||
|
@ -139,7 +139,7 @@ pub mut:
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut d DockerConn) container_inspect(id string) ?ContainerInspect {
|
pub fn (mut d DockerConn) container_inspect(id string) ?ContainerInspect {
|
||||||
d.send_request(Method.get, 'containers/$id/json')?
|
d.send_request(Method.get, '/containers/$id/json')?
|
||||||
head, body := d.read_response()?
|
head, body := d.read_response()?
|
||||||
|
|
||||||
if head.status_code != 200 {
|
if head.status_code != 200 {
|
||||||
|
@ -161,7 +161,7 @@ pub fn (mut d DockerConn) container_inspect(id string) ?ContainerInspect {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut d DockerConn) container_remove(id string) ? {
|
pub fn (mut d DockerConn) container_remove(id string) ? {
|
||||||
d.send_request(Method.delete, 'containers/$id')?
|
d.send_request(Method.delete, '/containers/$id')?
|
||||||
head, body := d.read_response()?
|
head, body := d.read_response()?
|
||||||
|
|
||||||
if head.status_code != 204 {
|
if head.status_code != 204 {
|
||||||
|
@ -172,7 +172,7 @@ pub fn (mut d DockerConn) container_remove(id string) ? {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut d DockerConn) container_get_logs(id string) ?&StreamFormatReader {
|
pub fn (mut d DockerConn) container_get_logs(id string) ?&StreamFormatReader {
|
||||||
d.send_request(Method.get, 'containers/$id/logs?stdout=true&stderr=true')?
|
d.send_request(Method.get, '/containers/$id/logs?stdout=true&stderr=true')?
|
||||||
head := d.read_response_head()?
|
head := d.read_response_head()?
|
||||||
|
|
||||||
if head.status_code != 200 {
|
if head.status_code != 200 {
|
||||||
|
|
6
images.v
6
images.v
|
@ -10,7 +10,7 @@ pub:
|
||||||
|
|
||||||
// pull_image pulls the given image:tag.
|
// pull_image pulls the given image:tag.
|
||||||
pub fn (mut d DockerConn) pull_image(image string, tag string) ? {
|
pub fn (mut d DockerConn) pull_image(image string, tag string) ? {
|
||||||
d.send_request(Method.post, 'images/create?fromImage=$image&tag=$tag')?
|
d.send_request(Method.post, '/images/create?fromImage=$image&tag=$tag')?
|
||||||
head := d.read_response_head()?
|
head := d.read_response_head()?
|
||||||
|
|
||||||
if head.status_code != 200 {
|
if head.status_code != 200 {
|
||||||
|
@ -33,7 +33,7 @@ pub fn (mut d DockerConn) pull_image(image string, tag string) ? {
|
||||||
|
|
||||||
// create_image_from_container creates a new image from a container.
|
// create_image_from_container creates a new image from a container.
|
||||||
pub fn (mut d DockerConn) create_image_from_container(id string, repo string, tag string) ?Image {
|
pub fn (mut d DockerConn) create_image_from_container(id string, repo string, tag string) ?Image {
|
||||||
d.send_request(Method.post, 'commit?container=$id&repo=$repo&tag=$tag')?
|
d.send_request(Method.post, '/commit?container=$id&repo=$repo&tag=$tag')?
|
||||||
head, body := d.read_response()?
|
head, body := d.read_response()?
|
||||||
|
|
||||||
if head.status_code != 201 {
|
if head.status_code != 201 {
|
||||||
|
@ -49,7 +49,7 @@ pub fn (mut d DockerConn) create_image_from_container(id string, repo string, ta
|
||||||
|
|
||||||
// remove_image removes the image with the given id.
|
// remove_image removes the image with the given id.
|
||||||
pub fn (mut d DockerConn) remove_image(id string) ? {
|
pub fn (mut d DockerConn) remove_image(id string) ? {
|
||||||
d.send_request(Method.delete, 'images/$id')?
|
d.send_request(Method.delete, '/images/$id')?
|
||||||
head, body := d.read_response()?
|
head, body := d.read_response()?
|
||||||
|
|
||||||
if head.status_code != 200 {
|
if head.status_code != 200 {
|
||||||
|
|
Loading…
Reference in New Issue