Code Monkey home page Code Monkey logo

Comments (10)

azagniotov avatar azagniotov commented on May 17, 2024

Cheers,
Will have a look

Delivered to you from my iDevice

On Mar 28, 2013, at 4:16 PM, ashishsharma09 [email protected] wrote:

With stubbyClient.startJetty only stubbyClient.doGet works. When I try to access the configured URL from Browser or using apache HttpClient or HttpConnection, the response is 404. Why the jetty server started through stubbyClient not visible to other APIs.


Reply to this email directly or view it on GitHub.

from stubby4j.

ashishsharma09 avatar ashishsharma09 commented on May 17, 2024

I eventually found out it's the query string that is causing the problem, not sure though why that is working with stubbyClient but not with apache HttpClient or browser. The query string parameter that is causing the problem is as follows:
attributes: '["id","uuid","created","lastUpdated","displayName","email","givenName","familyName"]'. So my config.yaml looks like:

-  request:
      method: GET
      url: /entity.find
      query:
         type_name: user
         client_id: id
         client_secret: secret
         attributes: '["id","uuid","created","lastUpdated","displayName","email","givenName","familyName"]'
   response:
      status: 200
      file: entity-find-response.json
      headers:
         content-type: application/json

If I remove the "attributes" parameter above it works all right. But with it I get 404 on accessing from browser or apache HttpGet. Please note single quotes around the value for "attributes". If I remove it, stubbyClient starts returning 404 as well.

from stubby4j.

ashishsharma09 avatar ashishsharma09 commented on May 17, 2024

Hi,

Has anyone had a chance to look into it yet? I think I have found what was causing the problem. It's the double quotes in the query parameter which causes the problem (took me good two days with lots of trial and error to figure it out). I was initially wrongly assuming it's the '[]' brackets. So following is my finding:

attributes: ["id"] - fails with 404.
attributes: '["id"]'- fails from browser and any other http client api. Works with StubbyClient only.
attributes: '[%22id%22]' - makes browser and everyone else happy.

I would expect it to work with ["id"] as this is more sensible and readable. If you get a chance please give it a go and let me know what you think.

FYI - I tried file: as well in the request but that did not help either.

Thanks,
Ashish

from stubby4j.

mrak avatar mrak commented on May 17, 2024

It looks as if query-string parameters are not being URI-encoded while loading them into the system (or at least not at all entry points).

Sorry for the lack of "official" responses. We've been tied down at work lately. Flagging this as a bug.

Also edited a couple of the comments here to make the code portions more readable.

from stubby4j.

azagniotov avatar azagniotov commented on May 17, 2024

I am looking into this... Stay tuned

from stubby4j.

azagniotov avatar azagniotov commented on May 17, 2024

Ok... I have put a fix in place for the scenario when query string contains array with elements within as per your example. I have tested both for:
http://localhost:8882/entity.find?type_name=user&client_id=id&client_secret=secret&attributes=["id","uuid","created","lastUpdated","displayName","email","givenName","familyName"]
and
http://localhost:8882/entity.find.again?type_name=user&client_id=id&client_secret=secret&attributes=[id,uuid,created,lastUpdated,displayName,email,givenName,familyName]

Works both when making request programmatically via StubbyClient and browser. The bug will be resolved in v1.0.59. Will push it to Maven Central shortly

from stubby4j.

azagniotov avatar azagniotov commented on May 17, 2024

You can continue using your original configuration:

-  request:
      method: GET
      url: /entity.find
      query:
         type_name: user
         client_id: id
         client_secret: secret
         attributes: '["id","uuid","created","lastUpdated","displayName","email","givenName","familyName"]'
   response:
      status: 200
      file: entity-find-response.json
      headers:
         content-type: application/json

In other words, no need to replace double quotes with %22 in you YAML

from stubby4j.

azagniotov avatar azagniotov commented on May 17, 2024

I am closing the ticket for now, but please report if the problem is still persists.

from stubby4j.

ashishsharma09 avatar ashishsharma09 commented on May 17, 2024

Hi,

Thanks for putting the fix in place so quickly. I will pick up the new version and try as soon as possible. Can't wait to see my yaml look pretty again. Will keep you posted...

Thanks,
Ashish

from stubby4j.

azagniotov avatar azagniotov commented on May 17, 2024

Hi Ashish,

Just in case, I am also supporting for:
http://localhost:8882/entity.find.single.quote?type_name=user&client_id=id&client_secret=secret&attributes=['id','uuid','created']
where array elements are enclosed with single quotes

Just get the latest version of stubby

from stubby4j.

Related Issues (20)

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.