Git Product home page Git Product logo

gurl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gurl's Issues

Enable logging of requests

As a developer
I want to log HTTP requests
So that it is possible to debug or trace communication with remote entity

The debug level is required to

  • debug output entire HTTP request / response, including content
  • notice output entire HTTP request / response, with content snippet
  • info output request URL and status code

Send application/x-www-form-urlencoded as string

gurl.HTTP(
  ø.POST("/auth/token"),
  ø.ContentForm(),
  ø.Send("grant_type=authorization_code&code="+code),
  ƒ.Code(200),
  ...

fails with error

json: cannot unmarshal string into Go value of type map[string]string

ø.Send supports only structured input

Missing pattern match to bytes

...
ƒ.Bytes(&x),
ƒ.Value(&x).String("xxx"),
...

String fails to compare byte with string. It requires

...
ƒ.Bytes(&x),
ƒ.Value(&x).Bytes([]byte{"xxx"}),
...

Future type for point of pointer

The following code snippet fails with null pointer

type A struct {
   V string `json:"a"`
}

type B struct {
  A *A `json:"b"`
}

val := B{} 

http.Join(
   ø.GET("http://example/%s", &val.A.V),
...

Here is classical cases: pointer of pointer. The construct &val.A.V always points to last value but intermediate A is not initialised yet.

Apply URL escapes to arguments

args needs to be escaped.

func GET(uri string, args ...interface{}) gurl.Arrow {
	return URL("GET", fmt.Sprintf(uri, args...))
}

Support formatting at URL

ø.GET.URL("%s/%s/%d/levels/%f", ø.Authority(host), valString, valInt, valFloat)

It fails with

invalid URL escape "%!f"

Refactor IOCat into Context

Existing implementation has dependency to IO Stack. The Context pattern is a right abstraction of this type.
Make it as a context simplifies API.

Deprecate usage of ! symbol to control path escaping.

Usage of ø.GET.URL becomes difficult to understand when ! symbol is used. It is not obvious when api makes escaping when not. The ø.GET.URL should support following use-case:

  1. Host is know and well defined to the template
  2. Host is not know and it is derived from config
  3. Host is not known and it is derived during I/O
  4. Path segments are defined either from const or dynamically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.