Repository: opencomponents/oc (js)

Issue:
context.setHeader from server.js not being applied when calling getData function oc-react-template
## This is effecting anyone one that is using a client getData call from oc-react-template and the server does a context.setHeader the header is not being set.

What I found is that headers are being set in component.js (below), but when a getData call is being make it is using components.js 

Setting headers:
https://github.com/opencomponents/oc/blob/master/src/registry/routes/component.js#L29

Not setting headers:
https://github.com/opencomponents/oc/blob/master/src/registry/routes/components.js#L64

I have fixed this locally by adding this code below:
```
const setHeaders = (results, res) => results.forEach(result => _.isEmpty(result.headers)|| res.set(result.headers));
```
In the result calling the function above:
```
(err, results) => {setHeaders(results,res); res.status(200).json(results);}
```

Pull request:
set headers for getComponents
Fix issue: 
https://github.com/opencomponents/oc/issues/1023

**Test plan (required)**
Setting a header using context in server.js
![image](https://user-images.githubusercontent.com/40531/56231841-67b25700-604d-11e9-8d7a-44b1f8b0c8e7.png)

From: client side:
![image](https://user-images.githubusercontent.com/40531/56232088-f3c47e80-604d-11e9-8501-2e1063ee19da.png)

Result: No cookie..

After change: (Cookie!)
![image](https://user-images.githubusercontent.com/40531/56232158-1a82b500-604e-11e9-9fe7-2224f90c05b3.png)




**Closing issues**
closes #1023


Patch:
diff --git a/src/registry/routes/components.js b/src/registry/routes/components.js
index 4cf8b142..6cd999bf 100644
--- a/src/registry/routes/components.js
+++ b/src/registry/routes/components.js
@@ -9,6 +9,12 @@ const strings = require('../../resources');
 
 module.exports = function(conf, repository) {
   const getComponent = new GetComponentHelper(conf, repository);
+  const setHeaders = (results, res) => {
+    if (!results || results.length !== 1 || !results[0] || !res.set) {
+      return;
+    }
+    res.set(results[0].headers);
+  };
 
   return function(req, res) {
     const components = req.body.components,
@@ -61,7 +67,10 @@ module.exports = function(conf, repository) {
           result => callback(null, result)
         );
       },
-      (err, results) => res.status(200).json(results)
+      (err, results) => {
+        setHeaders(results, res);
+        res.status(200).json(results);
+      }
     );
   };
 };


Test patch:
diff --git a/test/acceptance/registry.js b/test/acceptance/registry.js
index 7e7f80a7..a8026f75 100644
--- a/test/acceptance/registry.js
+++ b/test/acceptance/registry.js
@@ -186,9 +186,9 @@ describe('registry', () => {
         );
       });
 
-      it('should not set HTTP custom headers', () => {
-        expect(headers).to.not.have.property('cache-control');
-        expect(headers).to.not.have.property('test-header');
+      it('should set HTTP custom headers', () => {
+        expect(headers).to.have.property('cache-control');
+        expect(headers).to.have.property('test-header');
       });
 
       it('should return the component with custom headers', () => {
@@ -201,7 +201,7 @@ describe('registry', () => {
       });
     });
 
-    describe('with the default configuration (no customHeadersToSkipOnWeakVersion defined) and weak version 1.x.x', () => {
+    describe('request with two components', () => {
       before(done => {
         request(
           {
@@ -212,7 +212,11 @@ describe('registry', () => {
               components: [
                 {
                   name: 'hello-world-custom-headers',
-                  version: '1.x.x'
+                  version: '1.0.0'
+                },
+                {
+                  name: 'hello-world',
+                  version: '1.0.0'
                 }
               ]
             }
@@ -222,9 +226,34 @@ describe('registry', () => {
       });
 
       it('should not set HTTP custom headers', () => {
-        expect(headers).to.not.have.property('cache-control');
         expect(headers).to.not.have.property('test-header');
       });
+    });
+
+    describe('with the default configuration (no customHeadersToSkipOnWeakVersion defined) and weak version 1.x.x', () => {
+      before(done => {
+        request(
+          {
+            url: 'http://localhost:3030',
+            json: true,
+            method: 'post',
+            body: {
+              components: [
+                {
+                  name: 'hello-world-custom-headers',
+                  version: '1.x.x'
+                }
+              ]
+            }
+          },
+          next(done)
+        );
+      });
+
+      it('should set HTTP custom headers', () => {
+        expect(headers).to.have.property('cache-control');
+        expect(headers).to.have.property('test-header');
+      });
 
       it('should return the component with custom headers in the response body', () => {
         expect(result[0].response.version).to.equal('1.0.0');
@@ -273,9 +302,9 @@ describe('registry', () => {
           );
         });
 
-        it('should not set HTTP custom headers', () => {
-          expect(headers).to.not.have.property('cache-control');
-          expect(headers).to.not.have.property('test-header');
+        it('should set HTTP custom headers', () => {
+          expect(headers).to.have.property('cache-control');
+          expect(headers).to.have.property('test-header');
         });
 
         it('should return the component with the custom headers', () => {
@@ -310,9 +339,8 @@ describe('registry', () => {
           );
         });
 
-        it('should not set HTTP custom headers', () => {
-          expect(headers).to.not.have.property('cache-control');
-          expect(headers).to.not.have.property('test-header');
+        it('should have HTTP custom headers', () => {
+          expect(headers).to.have.property('test-header');
         });
 
         it('should skip Cache-Control header', () => {