Code Monkey home page Code Monkey logo

buddy-core's Introduction

buddy-core

buddy-core's People

Contributors

djklim87 avatar donhardman avatar nick-s-2018 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

buddy-core's Issues

A little problem with URL parsing

In the code below, the path of the URL is processed with rtrim and ltrim.

This process trims the "?" at the end, but it cannot be processed when parameters are included, such as /_bulk?timeout=60s.

  • src/Network/Request.php
    protected function parseOrFail(array $payload): static {
        static::validateInputFields($payload, static::PAYLOAD_FIELDS);

        // Checking if request format and endpoint are supported
        $this->path = rtrim(ltrim($payload['message']['path_query'], '/'), '?');    # here!

I understand that it currently evaluates endpoints containing parameters such as "sql?mode=raw".
I don't think this implementation is clean.

In the first place, PHP has a parse_url() function, so it may be easier to implement using that function.
And I think it's better to evaluate paths and parameters separately. Also in the future.

$origin = "/_bulk?timeout=60s";
$pathInfo =  parse_url($origin);
var_dump($pathInfo);

# array(2) {
#  ["path"]=>
#  string(6) "/_bulk"
#  ["query"]=>
#  string(11) "timeout=60s"
}

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.