groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8209) create simple http client
Date Thu, 01 Jun 2017 10:06:04 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16032734#comment-16032734
] 

ASF GitHub Bot commented on GROOVY-8209:
----------------------------------------

GitHub user dlukyanov opened a pull request:

    https://github.com/apache/groovy/pull/556

    GROOVY-8209 simple http client without extra dependecies [WIP]

    The idea is to create a simple http client without extra dependencies that will cover
rest client needs.
    
    Code example:
    ```groovy
    def r = HTTP.get(
      url : 'https://www.googleapis.com/customsearch/v1',
      query: [ q: 'hello world' ],
      headers: [
        'Accept':'application/json',
        //'Authorization' : ...,
      ],
      //optional - ssl context 
      ssl : getNaiveSSLContext(),
      //optional - receiver
      receiver : { stream,context -> new JsonParser().parse(stream) },
      //optional - body
    )
    assert r.response.code == 200
    println r.response.body
    
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dlukyanov/groovy master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/556.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #556
    
----
commit f778621973fc8213fcff2a93ce772f4945b85a1f
Author: dlukyanov <dlukyanov@ukr.net>
Date:   2017-06-01T09:56:28Z

    GROOVY-8209 initial version

----


> create simple http client
> -------------------------
>
>                 Key: GROOVY-8209
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8209
>             Project: Groovy
>          Issue Type: New Feature
>          Components: groovy-jdk
>            Reporter: Dmitry Lukyanov
>            Priority: Minor
>         Attachments: HTTP.groovy
>
>
> The idea is to create a simple http client based only on current groovy abilities.
> Code example:
> {code:java}
> def r = HTTP.get(
>   url : 'https://www.googleapis.com/customsearch/v1',
>   query: [ q: 'hello world' ],
>   headers: [
>     'Accept':'application/json',
>     //'Authorization' : ...,
>   ],
>   //optional - ssl context 
>   ssl : getNaiveSSLContext(),
>   //optional - receiver
>   receiver : { stream,context -> new JsonParser().parse(stream) },
>   //optional - body to perform data transfer (post/put/... http methods) 
> )
> assert r.response.code == 200
> println r.response.body
> {code}
> I suggest to integrate this class (attached) into groovy.
> Before opening a pull request I'd like to know opinion of the language owners/gurus:
is it ok? or maybe this functionality repeats something, that i missed/



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message