Git Product home page Git Product logo

Comments (6)

shavo007 avatar shavo007 commented on August 29, 2024

I have got a bit further but not much!
In the response I added in two headers:

+ Headers

            Access-Control-Allow-Origin: *
            Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept

Angular http service now calls get instead of options but it just keeps looping and inevitably crashes!!!

[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email
[LOG] GET /subscribe?id=12345&type=xyz&email=xyz&hv=xyz
[DRAKOV] GET /subscribe{?id,type,email,hv} Subscribe by email

from drakov.

shavo007 avatar shavo007 commented on August 29, 2024

i think instead of adding in the custom headers to the blueprint file, i need to work out for local development how to host drakov and grunt connect on the same domain (localhost). I think i need a proxy!!!

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

CORS is enabled by default, so I'm not sure if I can explain why it doesn't respond.

Are you able to post the endpoint snippet from the markdown file?

from drakov.

shavo007 avatar shavo007 commented on August 29, 2024

Cheers for the reply mate.

This is my code snippet from my .md file.

# Group Subscriptions


## Subscription  [/api/subscribe{?id,type,email,hv}]


+ Parameters
    + id (string, `12345`, required) ... Tracking number(s) [delimiter is ',']
    + type (string, `xyz`, optional) ... the type of the item represented by the id field. If this is populated, id is expected to be a single  track  number.
    + email (string, `[email protected]`, optional) ...  the email address to which track advice will be sent
    + hv (string, `xyz`, optional) ... the hash used to validate the id and email address fields



### Subscribe by email [GET]

+ Response 200

    + Headers

            content-type: application/json

    + Body

              {
                  "QueryTrackEventsResponse": {
                      "TrackingResult": {
                          "ReturnMessage": {
                              "Code": "ESB-10000",
                              "Description": "Success"
                          },
                          "TrackingID": "xxx",
                          "ArticleDetails": {
                              "ArticleID": "xxx",
                              "EventNotification": "00",
                              "ProductName": "International",
                              "ClientStatus": "None",
                              "EventCount": 0
                          }
                      }
                  }
              }

In the server log I see:

[LOG] Setup Route: GET /api/subscribe Subscribe by email

I have added in the config to use a connect-proxy.

Once I did this, it resolved the issue!!!

This is a snippet of the proxy config in my gruntFile.js

     proxies: [{
        context: '/api', // the context of the track microservice api
        host: 'localhost', // wherever the data service is running
        port: 3000 // the port that the microservice is running on
      }],

Do you believe I do not need the proxy?

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

sorry for the late reply, we use Drakov with protractor tests that run static Angular.js interfaces with no need of a proxy.

Maybe the proxy is modifying the headers somehow.

from drakov.

shavo007 avatar shavo007 commented on August 29, 2024

From what I read, you need a proxy when you are running a back-end server to prevent CORS.

Closing as the above plugin worked for me.

from drakov.

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.