Skip to content

Commit

Permalink
feat: add support for authToken prop (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir Maoz authored Jul 20, 2022
1 parent af31997 commit 2f1a2f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions __tests__/image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ describe('Image', () => {

expect(tag.find('img').prop('src')).toEqual(expected);
});
it('Should support authToken param', function () {
const authToken = 'ip=111.222.111.222~exp=1512982559~acl=%2fimage%2fauthenticated%2f%2a~hmac=b17360091889151e9c2e2a7c713a074fdd29dc4ef1cc2fb897a0764664f3c48d';
const expected = `http://res.cloudinary.com/demo/image/upload/sample?__cld_token__=${authToken}`;

const tag = mount(
<Image cloudName='demo' publicId='sample' authToken={authToken} />
);

expect(tag.find('img').prop('src')).toEqual(expected);
});
describe('Responsive', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation();

Expand Down
2 changes: 1 addition & 1 deletion src/Util/cloudinaryReactUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
const { camelCase, withCamelCaseKeys, isEmpty } = Util;

// props passed to cloudinary-core but should not be rendered as dom attributes
const CLOUDINARY_REACT_PROPS = ['accessibility', 'breakpoints', 'dataSrc', 'placeholder', 'publicId', 'signature'];
const CLOUDINARY_REACT_PROPS = ['accessibility', 'breakpoints', 'dataSrc', 'placeholder', 'publicId', 'signature', 'authToken'];

/**
* Convert common video file extensions to mime types
Expand Down

0 comments on commit 2f1a2f2

Please sign in to comment.