2016-03-21 29 views
2

ile PUT isteği ile veri yazabilirim Sadece bu cURL çağrısını sesli kitap listesine çevirmeye çalışıyorum.Ansel URI modülü

  • cURL çağrı:

    curl -X PUT -d "value={aa}" "http://172.31.64.174:2379/v2/keys/coreos.com/network/config" 
    
  • yanıtlayıcı 'oyun kitabı:

    - uri: 
        url: "http://172.31.64.174:2379/v2/keys/coreos.com/network/config" 
        method: PUT 
        body: "value={aa}" 
    

ben bunu denedim ancak sunucu PUT dilekçesi alan, ancak değer değişmez. Herhangi bir yardım çok takdir

* Trying 172.31.64.174... 
* Connected to 172.31.64.174 (172.31.64.174) port 2379 (#0) 
> PUT /v2/keys/coreos.com/network/config HTTP/1.1 
> Host: 172.31.64.174:2379 
> User-Agent: curl/7.47.1 
> Accept: */* 
> Content-Length: 10 
> Content-Type: application/x-www-form-urlencoded 
> 
* upload completely sent off: 10 out of 10 bytes 
< HTTP/1.1 200 OK 
< Content-Type: application/json 
< X-Etcd-Cluster-Id: 1dd872ea8ead78 
< X-Etcd-Index: 325563 
< X-Raft-Index: 1356544 
< X-Raft-Term: 2694 
< Date: Mon, 21 Mar 2016 08:48:33 GMT 
< Content-Length: 228 
< 
{"action":"set","node":{"key":"/coreos.com/network/config","value":"{aa}","modifiedIndex":325563,"createdIndex":325563},"prevNode"{"key":"/coreos.com/network/config","value":"{a}","modifiedIndex":324785,"createdIndex":324785}} 
* Connection #0 to host 172.31.64.174 left intact 

:

bu kıvrılmayı prosedüründen ayrıntılı verilir. peşin

Teşekkür

Nihayet

cevap

1

Ben bu satırları ekleyerek durum kodu, başlığının içerik türünü ve dönüş içeriğini ayarlayarak çalışma var:

status_code: 200 
return_content: yes 
HEADER_Content-Type: "application/x-www-form-urlencoded" 

gibi bakmak gerekir Yani nihai:

- uri: 
    url: "{{ etcd_server }}/v2/keys/coreos.com/network/config" 
    method: PUT 
    body: "value={aa}" 
    status_code: 200 
    return_content: yes 
    HEADER_Content-Type: "application/x-www-form-urlencoded"