You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ecerulm (via GitHub)" <gi...@apache.org> on 2023/05/31 12:26:34 UTC

[GitHub] [couchdb] ecerulm opened a new pull request, #4628: Fix typo POST -> PUT

ecerulm opened a new pull request, #4628:
URL: https://github.com/apache/couchdb/pull/4628

   <!-- Thank you for your contribution!
   
        Please file this form by replacing the Markdown comments
        with your text. If a section needs no action - remove it.
   
        Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
        of code collaboration. Positive feedback is represented +1 from committers
        and negative is a -1. The -1 also means veto, and needs to be addressed
        to proceed. Once there are no objections, the PR can be merged by a
        CouchDB committer.
   
        See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
   
   ## Overview
   
   <!-- Please give a short brief for the pull request,
        what problem it solves or how it makes things better. -->
   The documentation says PUT but then the example says POST. This PR fixes so that both says PUT.
   
   ![image](https://github.com/apache/couchdb/assets/58676/5f609d21-1fc5-4389-a47e-60fd1af9bc5b)
   
   I have tried myself and it seem that both PUT and POST can actually be used, but I assuming that PUT is the preferred. 
   
   **PUT*:
   ``` 
   curl -v -n  -T  functioninput.txt  http://couchdb.localhost:5984/hello-world/_design/recipe/_update/ingredients/SpaghettiWithMeatballs
   ....
   > PUT /hello-world/_design/recipe/_update/ingredients/SpaghettiWithMeatballs HTTP/1.1
   > Host: couchdb.localhost:5984
   ...
   > 
   ....
   < HTTP/1.1 201 Created
   < Cache-Control: must-revalidate
   ...
   < X-Couch-Id: SpaghettiWithMeatballs
   < X-Couch-Request-ID: 2bf74089ac
   < X-Couch-Update-NewRev: 5-055c4a14bbd3949a0fb5dad68ac576da
   < X-CouchDB-Body-Time: 0
   < 
   {"status":"ok"}
   ``` 
   
   
   **POST**:
   ```
   curl -v -n --json 'love'  http://couchdb.localhost:5984/hello-world/_design/recipe/_update/ingredients/SpaghettiWithMeatballs       
   ...
   > POST /hello-world/_design/recipe/_update/ingredients/SpaghettiWithMeatballs HTTP/1.1
   > Host: couchdb.localhost:5984
   ...
   < HTTP/1.1 201 Created
   ...
   < 
   {"status":"ok"}
   * Connection #0 to host couchdb.localhost left intact
   ```
   
   
   
   ## Testing recommendations
   
   <!-- Describe how we can test your changes.
        Does it provide any behaviour that the end users
        could notice? -->
   
   ## Related Issues or Pull Requests
   
   <!-- If your changes affect multiple components in different
        repositories please put links to those issues or pull requests here.  -->
   
   ## Checklist
   
   - [N/A] Code is written and works correctly
   - [N/A] Changes are covered by tests
   - [N/A] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
   - [N/A] Documentation changes were made in the `src/docs` folder
   - [N/A] Documentation changes were backported (separated PR) to affected branches
   
   Since this is a **documentation only** change I assume nothing in this list applies.
     


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on pull request #4628: Fix typo POST -> PUT

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1570805507

   But perhaps we should document the behavior of if we change it, deprecate it make so gated with a feature so it won't break current 3.x users.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva merged pull request #4628: Fix typo POST -> PUT

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva merged PR #4628:
URL: https://github.com/apache/couchdb/pull/4628


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] ecerulm commented on pull request #4628: Fix typo POST -> PUT

Posted by "ecerulm (via GitHub)" <gi...@apache.org>.
ecerulm commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1571420310

   Since this PR is closed, I created a https://github.com/apache/couchdb/issues/4631 asking for a documentation change to document the `POST /{db}/_design/{ddoc}/_update/{func}/{docid}`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] big-r81 commented on pull request #4628: Fix typo POST -> PUT

Posted by "big-r81 (via GitHub)" <gi...@apache.org>.
big-r81 commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1570723680

   @nickva should we only allow PUT like in #4449?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] ecerulm commented on pull request #4628: Fix typo POST -> PUT

Posted by "ecerulm (via GitHub)" <gi...@apache.org>.
ecerulm commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1570156769

   Since  apparently both PUT and POST work , should both be mentioned in the [1.5.12](https://docs.couchdb.org/en/stable/api/ddoc/render.html#db-design-design-doc-update-update-name-doc-id)?  Maybe indicating which one is preferred over the other (if any). [3.1.5 Update Functions](https://docs.couchdb.com/en/latest/api/ddoc/render.html#db-design-ddoc-update-func-docid) hint that both `POST` and `PUT` are supported when it says: 
   
   > You can provide any other values needed by the update handler function via the POST/PUT entity body or query string parameters of the request. 
   
   But it both are supported I guess both should be explicitly mention at [1.5.12](https://docs.couchdb.org/en/stable/api/ddoc/render.html#db-design-design-doc-update-update-name-doc-id). 
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on pull request #4628: Fix typo POST -> PUT

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1570801221

   I was wondering about it too, @big-r81. I think it may be a compatibility issue if someone was POST.
   
   It seems in general it's a free-for-all kind of an endpoint the _update handler js code gets to decide what to do by inspecting the `method`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on pull request #4628: Fix typo POST -> PUT

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1570605716

   @ecerulm thank you for your contribution. I think in the example PUT would make more sense since we have a document ID passed in. But you're also right that it seems POST is allowed. The updater handler gets a request object and method is part of so it can choose what to do with it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on pull request #4628: Fix typo POST -> PUT

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4628:
URL: https://github.com/apache/couchdb/pull/4628#issuecomment-1571432062

   Thank you, @ecerulm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org